diff --git a/assets/icons/menuicon.svg b/assets/icons/menuicon.svg
index 5881ef8..26e448a 100644
--- a/assets/icons/menuicon.svg
+++ b/assets/icons/menuicon.svg
@@ -1,17 +1,17 @@
diff --git a/assets/stylesheets/App.css b/assets/stylesheets/App.css
index 17a227d..d3f4b60 100644
--- a/assets/stylesheets/App.css
+++ b/assets/stylesheets/App.css
@@ -63,10 +63,13 @@
line-height: 40px;
}
-.electron-sidebar .ant-menu-item {
- height: 32.5px;
- line-height: 32.5px;
- padding-inline: calc(50% - 8px - 4px);
+.electron-navigation .ant-menu-overflow-item-rest {
+ padding-inline: 10px;
+}
+
+.electron-sidebar .ant-menu-item, .electron-sidebar .ant-menu-submenu-title {
+ height: 32.5px !important;
+ line-height: 32.5px !important;
}
.electron-sider.ant-layout-sider-collapsed {
diff --git a/design_files/menuicon.afdesign b/design_files/menuicon.afdesign
index 55bbfa8..ed8dc5c 100644
Binary files a/design_files/menuicon.afdesign and b/design_files/menuicon.afdesign differ
diff --git a/src/components/Dashboard/common/DashboardNavigation.jsx b/src/components/Dashboard/common/DashboardNavigation.jsx
index 5d5af44..33cf3fb 100644
--- a/src/components/Dashboard/common/DashboardNavigation.jsx
+++ b/src/components/Dashboard/common/DashboardNavigation.jsx
@@ -9,12 +9,12 @@ import {
Button,
Tooltip,
Badge,
- Divider
+ Divider,
+ Typography
} from 'antd'
import {
LogoutOutlined,
MailOutlined,
- MenuOutlined,
LoadingOutlined
} from '@ant-design/icons'
import { AuthContext } from '../context/AuthContext'
@@ -27,6 +27,7 @@ import KeyboardShortcut from './KeyboardShortcut'
import FarmControlLogo from '../../Logos/FarmControlLogo'
import FarmControlLogoSmall from '../../Logos/FarmControlLogoSmall'
+import MenuIcon from '../../Icons/MenuIcon'
import ProductionIcon from '../../Icons/ProductionIcon'
import InventoryIcon from '../../Icons/InventoryIcon'
import PersonIcon from '../../Icons/PersonIcon'
@@ -38,6 +39,8 @@ import DeveloperIcon from '../../Icons/DeveloperIcon'
import { ElectronContext } from '../context/ElectronContext'
import DashboardWindowButtons from './DashboardWindowButtons'
+const { Text } = Typography
+
const DashboardNavigation = () => {
const { logout, userProfile } = useContext(AuthContext)
const { showSpotlight } = useContext(SpotlightContext)
@@ -47,27 +50,14 @@ const DashboardNavigation = () => {
const navigate = useNavigate()
const location = useLocation()
const [selectedKey, setSelectedKey] = useState('production')
+ const [selectedMenuItem, setSelectedMenuItem] = useState({
+ key: 'production',
+ label: 'Production',
+ icon:
+ })
const isMobile = useMediaQuery({ maxWidth: 768 })
const { platform, isElectron, isFullScreen } = useContext(ElectronContext)
- useEffect(() => {
- const pathParts = location.pathname.split('/').filter(Boolean)
- if (pathParts.length > 2) {
- setSelectedKey(pathParts[1]) // Return the section (production/management)
- }
- }, [location.pathname])
-
- useEffect(() => {
- if (connecting == true) {
- setApiServerState('connecting')
- } else if (connected == true) {
- setApiServerState('connected')
- } else {
- setApiServerState('disconnected')
- }
- console.log('Connecting/connected', connecting, connected)
- }, [connecting, connected])
-
const mainMenuItems = [
{
key: 'production',
@@ -115,6 +105,27 @@ const DashboardNavigation = () => {
}
}
+ useEffect(() => {
+ const pathParts = location.pathname.split('/').filter(Boolean)
+ if (pathParts.length > 2) {
+ setSelectedMenuItem(
+ mainMenuItems.filter((item) => item.key == pathParts[1])[0]
+ )
+ setSelectedKey(pathParts[1]) // Return the section (production/management)
+ }
+ }, [location.pathname])
+
+ useEffect(() => {
+ if (connecting == true) {
+ setApiServerState('connecting')
+ } else if (connected == true) {
+ setApiServerState('connected')
+ } else {
+ setApiServerState('disconnected')
+ }
+ console.log('Connecting/connected', connecting, connected)
+ }, [connecting, connected])
+
const handleMainMenuClick = ({ key }) => {
if (key === 'production') {
navigate('/dashboard/production/overview')
@@ -125,35 +136,91 @@ const DashboardNavigation = () => {
}
}
+ const showAppLogo =
+ (isElectron && platform == 'darwin' && isFullScreen == true) ||
+ (isElectron && platform != 'darwin')
+ const isMacOSApp = isElectron && platform == 'darwin'
+ const isOtherApp = isElectron && platform != 'darwin'
+
+ const showDesktopLogo = !isElectron && !isMobile
+ const showMobileLogo = !isElectron && isMobile
+
const navigationContents = (
- {isElectron && platform == 'darwin' ? : null}
- {(!isElectron || (platform == 'darwin' && isFullScreen == true)) &&
- !isMobile ? (
+ {isMacOSApp ? : null}
+ {showAppLogo == true && (
+
+ )}
+ {showDesktopLogo == true ? (
+ ) : showMobileLogo == true ? (
+
- ) : !isElectron && isMobile ? (
-
) : null}
+ {isMobile && (
+
+ {selectedMenuItem.icon}
+
+ {selectedMenuItem.label}
+
+
+ )}
} />}
+ overflowedIndicator={
+ }
+ style={{ marginBottom: '4px' }}
+ />
+ }
/>
+ {isMobile && }
{
) : null}
+ {isOtherApp ? : null}
)
@@ -243,7 +311,7 @@ const DashboardNavigation = () => {
{isElectron ? (
{navigationContents}
diff --git a/src/components/Dashboard/common/DashboardWindowButtons.jsx b/src/components/Dashboard/common/DashboardWindowButtons.jsx
index d4c11a5..19d6a63 100644
--- a/src/components/Dashboard/common/DashboardWindowButtons.jsx
+++ b/src/components/Dashboard/common/DashboardWindowButtons.jsx
@@ -36,7 +36,7 @@ const DashboardWindowButtons = () => {
{platform == 'darwin' ? (
isFullScreen == false ? (
-
+
) : null
) : (
<>
diff --git a/src/components/Dashboard/common/Flag.jsx b/src/components/Dashboard/common/Flag.jsx
index 3e81606..3a7e46f 100644
--- a/src/components/Dashboard/common/Flag.jsx
+++ b/src/components/Dashboard/common/Flag.jsx
@@ -7,6 +7,8 @@ const Flag = ({
hasDropShadow = false,
borderRadius = 0
}) => {
+ const useRelativePath =
+ typeof window !== 'undefined' && window.location.href.includes('index.html')
var flagContainerStyle = {}
var flagStyle = {}
if (hasBorder == true) {
@@ -31,7 +33,10 @@ const Flag = ({
}
return (
-
+
)
}
diff --git a/src/components/Dashboard/context/AuthContext.jsx b/src/components/Dashboard/context/AuthContext.jsx
index 3ed50c4..41f0ed7 100644
--- a/src/components/Dashboard/context/AuthContext.jsx
+++ b/src/components/Dashboard/context/AuthContext.jsx
@@ -105,6 +105,7 @@ const AuthProvider = ({ children }) => {
}
},
[
+ redirectType,
messageApi,
openExternalUrl,
isElectron,
diff --git a/vite.config.js b/vite.config.js
index 7f06921..3836525 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -5,9 +5,9 @@ import svgr from 'vite-plugin-svgr'
import svgo from 'vite-plugin-svgo'
export default defineConfig({
+ base: './',
plugins: [react(), svgo(), svgr(), eslintPlugin()],
build: {
- // to output your build into build dir the same as Webpack
outDir: 'build'
},
server: {