diff --git a/src/App.tsx b/src/App.tsx index e4c2e33..5d2ee4e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,7 @@ import { CssBaseline, ThemeProvider, createTheme } from '@mui/material'; import { BrowserRouter, Route, Routes } from 'react-router-dom'; import { DBProvider } from './context/DBProvider'; +import { AppLayout } from './components/AppLayout'; import { HomeScreen } from './screens/HomeScreen'; import { StartPickListScreen } from './screens/StartPickListScreen'; import { PickListsScreen } from './screens/PickListsScreen'; @@ -24,14 +25,16 @@ const AppRoutes = () => { useServiceWorker(); return ( - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> + }> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + ); }; diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx new file mode 100644 index 0000000..da4fd0c --- /dev/null +++ b/src/components/AppLayout.tsx @@ -0,0 +1,12 @@ +import { Box } from '@mui/material'; +import { Outlet } from 'react-router-dom'; +import { NavigationBar } from './NavigationBar'; + +export const AppLayout = () => ( + + + + + + +); diff --git a/src/components/NavigationBar.tsx b/src/components/NavigationBar.tsx new file mode 100644 index 0000000..b7cc3fe --- /dev/null +++ b/src/components/NavigationBar.tsx @@ -0,0 +1,54 @@ +import { AppBar, Box, Button, Toolbar, Typography } from '@mui/material'; +import { Link as RouterLink, useLocation } from 'react-router-dom'; + +const navLinks = [ + { to: '/', label: 'Home' }, + { to: '/start', label: 'Start' }, + { to: '/pick-lists', label: 'Pick Lists' }, + { to: '/products', label: 'Products' }, + { to: '/areas', label: 'Areas' }, + { to: '/scan', label: 'Scan' }, +]; + +const isActivePath = (currentPath: string, target: string) => + currentPath === target || currentPath.startsWith(`${target}/`); + +export const NavigationBar = () => { + const location = useLocation(); + + return ( + + + + StockFill + + + {navLinks.map((link) => { + const active = isActivePath(location.pathname, link.to); + return ( + + ); + })} + + + + ); +};