Files
Moonbase/src/components/layout/nav-items.ts
2026-06-29 17:28:28 -05:00

39 lines
1.6 KiB
TypeScript

import {
LayoutDashboard, Leaf, BookOpen, Package, PawPrint, MapPin, Bell,
Lightbulb, KeyRound, HardDrive, RefreshCw, UtensilsCrossed, type LucideIcon,
} from "lucide-react";
export type NavItem = { label: string; href: string; icon: LucideIcon; section?: string };
export const navItems: NavItem[] = [
{ label: "Dashboard", href: "/dashboard", icon: LayoutDashboard },
{ label: "Garden", href: "/garden", icon: Leaf },
{ label: "Plant types", href: "/garden/types", icon: BookOpen },
{ label: "Inventory", href: "/inventory", icon: Package },
{ label: "Animals", href: "/animals", icon: PawPrint },
{ label: "Locations", href: "/locations", icon: MapPin },
{ label: "Reminders", href: "/tasks", icon: Bell },
];
export const kitchenItems: NavItem[] = [
{ label: "Pantry & Freezer", href: "/kitchen/pantry", icon: UtensilsCrossed },
];
export const settingsItems: NavItem[] = [
{ label: "Suggestions", href: "/suggestions", icon: Lightbulb },
{ label: "API tokens", href: "/settings/tokens", icon: KeyRound },
{ label: "Backup & Restore", href: "/settings/backup", icon: HardDrive },
{ label: "Updates", href: "/settings/updates", icon: RefreshCw },
];
// Active on exact match or a sub-path, unless a more specific item (e.g.
// /garden/types) already claims the current path.
export function isNavActive(path: string, href: string, all: NavItem[]): boolean {
if (path === href) return true;
if (href === "/dashboard") return false;
if (!path.startsWith(href + "/")) return false;
return !all.some(
(o) => o.href.length > href.length && (path === o.href || path.startsWith(o.href + "/")),
);
}