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={ +