Lumen & Gesso / website · lumengesso.com / app / admin / AdminNav.tsx
| 1 | // Shared sub-header across /admin pages — signed-in identity on the left, |
| 2 | // pill-style nav on the right. Pass `current` so the active pill renders |
| 3 | // with the filled style. Server component; no client state. |
| 4 | |
| 5 | import Link from 'next/link'; |
| 6 | import { prodigiDashboardUrl } from '@/app/lib/prodigi-dashboard'; |
| 7 | |
| 8 | const NAV_ITEMS = [ |
| 9 | { href: '/admin', label: 'Commissions', key: 'commissions' }, |
| 10 | { href: '/admin/reviews', label: 'Reviews', key: 'reviews' }, |
| 11 | { href: '/admin/images', label: 'CDN images', key: 'images' }, |
| 12 | { href: '/admin/pinterest', label: 'Pinterest', key: 'pinterest' }, |
| 13 | ] as const; |
| 14 | |
| 15 | export type AdminNavKey = (typeof NAV_ITEMS)[number]['key']; |
| 16 | |
| 17 | export function AdminNav({ email, current }: { email: string; current: AdminNavKey }) { |
| 18 | return ( |
| 19 | <nav className="adminnav" aria-label="Admin sections"> |
| 20 | <div className="adminnav__who"> |
| 21 | <span className="adminnav__label">Signed in as</span>{' '} |
| 22 | <strong>{email}</strong> |
| 23 | </div> |
| 24 | <ul className="adminnav__tabs"> |
| 25 | {NAV_ITEMS.map((it) => { |
| 26 | const active = it.key === current; |
| 27 | return ( |
| 28 | <li key={it.key}> |
| 29 | <Link |
| 30 | href={it.href} |
| 31 | aria-current={active ? 'page' : undefined} |
| 32 | className={`adminnav__tab${active ? ' adminnav__tab--active' : ''}`} |
| 33 | > |
| 34 | {it.label} |
| 35 | </Link> |
| 36 | </li> |
| 37 | ); |
| 38 | })} |
| 39 | <li> |
| 40 | <a className="adminnav__tab" href={prodigiDashboardUrl(null, process.env.PRODIGI_API_BASE_URL?.includes('sandbox'))} target="_blank" rel="noopener noreferrer"> |
| 41 | Printer orders ↗ |
| 42 | </a> |
| 43 | </li> |
| 44 | </ul> |
| 45 | </nav> |
| 46 | ); |
| 47 | } |