Spaces:
Sleeping
Sleeping
Download apps/admin-web/app/components/AdminNav.tsx from ADI576/proflo-admin: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/spaces/ADI576/proflo-admin/resolve/main/apps/admin-web/app/components/AdminNav.tsx
- Command line
-
hf download hf://spaces/ADI576/proflo-admin/apps/admin-web/app/components/AdminNav.tsx
-
curl -L -o AdminNav.tsx https://huggingface.co/spaces/ADI576/proflo-admin/resolve/main/apps/admin-web/app/components/AdminNav.tsx
1.37 kB
| "use client"; | |
| export type AdminSection = "overview" | "inventory" | "orders" | "promotions" | "audit"; | |
| const ITEMS: { | |
| id: AdminSection; | |
| label: string; | |
| hint: string; | |
| managerOnly?: boolean; | |
| }[] = [ | |
| { id: "overview", label: "Overview", hint: "KPIs & analysis" }, | |
| { id: "inventory", label: "Inventory", hint: "Catalogue & stock" }, | |
| { id: "orders", label: "Orders", hint: "Checkouts & receipts" }, | |
| { id: "promotions", label: "Promotions", hint: "Discount rules" }, | |
| { id: "audit", label: "Audit log", hint: "Manager only", managerOnly: true } | |
| ]; | |
| type Props = { | |
| active: AdminSection; | |
| isManager: boolean; | |
| onChange: (section: AdminSection) => void; | |
| }; | |
| export function AdminNav({ active, isManager, onChange }: Props) { | |
| const visible = ITEMS.filter((item) => !item.managerOnly || isManager); | |
| return ( | |
| <nav className="adminNav" aria-label="Dashboard sections"> | |
| {visible.map((item) => ( | |
| <button | |
| key={item.id} | |
| type="button" | |
| className={`adminNav__item${active === item.id ? " adminNav__item--active" : ""}`} | |
| onClick={() => onChange(item.id)} | |
| aria-current={active === item.id ? "page" : undefined} | |
| > | |
| <span className="adminNav__label">{item.label}</span> | |
| <span className="adminNav__hint">{item.hint}</span> | |
| </button> | |
| ))} | |
| </nav> | |
| ); | |
| } | |