import Logo from '@/assets/logo.svg' import { AccountBox, HomeOutlined, ListAltRounded, Logout, MenuRounded, Message, SettingsOutlined, ShareOutlined, Widgets, } from '@mui/icons-material' import { Box, Drawer, IconButton, List, ListItemButton, ListItemContent, ListItemDecorator, Typography, } from '@mui/joy' import { useState } from 'react' import { useLocation } from 'react-router-dom' import { version } from '../../../package.json' import NavBarLink from './NavBarLink' const links = [ { to: '/my/chores', label: 'Home', icon: , }, { to: '/chores', label: 'Desktop View', icon: , }, { to: '/things', label: 'Things', icon: , }, { to: '/settings#sharing', label: 'Sharing', icon: , }, { to: '/settings#notifications', label: 'Notifications', icon: , }, { to: '/settings#account', label: 'Account', icon: , }, { to: '/settings', label: 'Settings', icon: , }, ] const NavBar = () => { const [drawerOpen, setDrawerOpen] = useState(false) const [openDrawer, closeDrawer] = [ () => setDrawerOpen(true), () => setDrawerOpen(false), ] const location = useLocation() // if url has /landing then remove the navbar: if ( ['/', '/signup', '/login', '/landing', '/forgot-password'].includes( location.pathname, ) ) { return null } return ( setDrawerOpen(true)}> Done tick✓ {/* */} {links.map((link, index) => ( ))} { localStorage.removeItem('ca_token') localStorage.removeItem('ca_expiration') // go to login page: window.location.href = '/login' }} sx={{ py: 1.2, }} > Logout V{version} ) } export default NavBar