feat(frontend): side-nav show what tab the user is in

This commit is contained in:
leandrofars 2024-06-09 14:30:17 -03:00
parent ed0deed5a3
commit fa047e5e51

View File

@ -24,6 +24,19 @@ export const SideNav = (props) => {
const pathname = usePathname(); const pathname = usePathname();
const lgUp = useMediaQuery((theme) => theme.breakpoints.up('lg')); const lgUp = useMediaQuery((theme) => theme.breakpoints.up('lg'));
const isItemActive = (currentPath, itemPath) => {
if (currentPath === itemPath) {
return true;
}
if (currentPath.includes(itemPath) && itemPath !== '/') {
return true;
}
return false;
//TODO: test frontend with color of the landing page
}
const content = ( const content = (
<Scrollbar <Scrollbar
sx={{ sx={{
@ -100,7 +113,7 @@ export const SideNav = (props) => {
}} }}
> >
{items.map((item) => { {items.map((item) => {
const active = item.path ? (pathname === item.path) : false; const active = isItemActive(pathname, item.path);
return ( return (
<SideNavItem <SideNavItem