updates on auth for the login creds and data linkage and updates on the deliveries page and queries section and updates on the test files
This commit is contained in:
@@ -222,10 +222,28 @@ function NotificationsMenu() {
|
||||
export default function AdminLayout() {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const { user, logout } = useAuth();
|
||||
const { user, isClient, logout } = useAuth();
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
const [assistantOpen, setAssistantOpen] = useState(false);
|
||||
|
||||
const navItems = useMemo(() => {
|
||||
if (isClient) {
|
||||
return NAV.filter((item) => item.path !== '/doormile/tenants');
|
||||
}
|
||||
return NAV;
|
||||
}, [isClient]);
|
||||
|
||||
const navGroups = useMemo(() => {
|
||||
if (isClient) {
|
||||
return NAV_GROUPS.filter((group) => group.label !== 'Fleet Ops');
|
||||
}
|
||||
return NAV_GROUPS;
|
||||
}, [isClient]);
|
||||
|
||||
const allDestinations = useMemo(() => {
|
||||
return [...navItems, ...navGroups.flatMap((group) => group.items)];
|
||||
}, [navItems, navGroups]);
|
||||
|
||||
const isActive = (path) => {
|
||||
if (path === ROOT) return location.pathname === ROOT;
|
||||
return location.pathname === path || location.pathname.startsWith(`${path}/`);
|
||||
@@ -269,7 +287,7 @@ export default function AdminLayout() {
|
||||
menu is styled as one more tab, so a destination reached through a
|
||||
menu still reads as being in the same row as the rest. */}
|
||||
<nav aria-label="Console" className="hidden min-w-0 flex-1 items-center gap-0.5 lg:flex">
|
||||
{NAV.map((item) => (
|
||||
{navItems.map((item) => (
|
||||
<Link
|
||||
key={item.path}
|
||||
to={item.path}
|
||||
@@ -291,7 +309,7 @@ export default function AdminLayout() {
|
||||
</Link>
|
||||
))}
|
||||
|
||||
{NAV_GROUPS.map((group) => (
|
||||
{navGroups.map((group) => (
|
||||
<DropdownMenu key={group.label}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button
|
||||
@@ -348,7 +366,7 @@ export default function AdminLayout() {
|
||||
<img className="h-9 w-9 max-w-none object-contain" src={doormileMark} alt="" aria-hidden="true" />
|
||||
</button>
|
||||
|
||||
<NotificationsMenu />
|
||||
{!isClient && <NotificationsMenu />}
|
||||
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
@@ -409,7 +427,7 @@ export default function AdminLayout() {
|
||||
<SheetTitle className="text-left font-heading text-title">Doormile Express</SheetTitle>
|
||||
</SheetHeader>
|
||||
<nav className="flex max-h-[calc(100dvh-8rem)] flex-col overflow-y-auto p-2">
|
||||
{ALL_DESTINATIONS.map((item) => (
|
||||
{allDestinations.map((item) => (
|
||||
<Link
|
||||
key={item.path}
|
||||
to={item.path}
|
||||
|
||||
Reference in New Issue
Block a user