/** The admin's sections, in groups (the sidebar) with a line each (the dashboard's tiles). */ import { Building2, CalendarDays, DatabaseBackup, FileText, HandHeart, Image as ImageIcon, LayoutDashboard, Link2, Mic, Palette, ScrollText, Send, Settings, Timer, UserCog, Users, type LucideIcon, } from "lucide-react"; export type NavItem = { href: string; label: string; description: string; icon: LucideIcon; managers?: boolean }; export const NAV_GROUPS: { title: string | null; items: NavItem[] }[] = [ { title: null, items: [{ href: "/admin", label: "Dashboard", description: "Where your site stands, and what to do next", icon: LayoutDashboard }] }, { title: "Your site", items: [ { href: "/admin/template", label: "Template and style", description: "The look: template, home page layout, colours of sections", icon: Palette }, { href: "/admin/pages", label: "Pages", description: "Your home page, the fixed pages and your own", icon: FileText }, { href: "/admin/church", label: "Church details", description: "Name, logo, service times and address, for all your sites", icon: Building2 }, ], }, { title: "Content", items: [ { href: "/admin/ministries", label: "Ministries", description: "What happens in your church, each on the Ministries page", icon: HandHeart }, { href: "/admin/leaders", label: "Leadership", description: "Your pastors and team, with photos", icon: Users }, { href: "/admin/messages", label: "Messages", description: "Sermons, from YouTube or Spotify", icon: Mic }, { href: "/admin/events", label: "Events", description: "What's coming up, or your Cross Events calendar", icon: CalendarDays }, { href: "/admin/media", label: "Media library", description: "Your photos, what each shows, and storage", icon: ImageIcon }, ], }, { title: "Go live", items: [ { href: "/admin/publish", label: "Publish and history", description: "What's changed, publish it, share a preview, go back", icon: Send }, { href: "/admin/linked", label: "Linked products", description: "Cross Events and your church's other sites", icon: Link2 }, { href: "/admin/settings", label: "Settings", description: "Search engines, the menu order, the Coming soon line", icon: Settings }, ], }, { title: "Team", items: [ { href: "/admin/people", label: "People", description: "Who can edit the site, and what they can do", icon: UserCog, managers: true }, { href: "/admin/audit", label: "Audit log", description: "Who changed what, and when", icon: ScrollText, managers: true }, ], }, { // 1.4.0, as Accounts and Cross Events. title: "Looking after it", items: [ { href: "/admin/backups", label: "Backups", description: "Copies of your site's database: back up now, download, how many to keep", icon: DatabaseBackup, managers: true }, { href: "/admin/jobs", label: "Background jobs", description: "What runs on a schedule, and when: switch each on or off", icon: Timer, managers: true }, ], }, ]; export const NAV: NavItem[] = NAV_GROUPS.flatMap((g) => g.items); /** The section an address is in: the longest match, so /admin/pages/… is Pages. */ export const sectionFor = (path: string): NavItem | undefined => NAV.filter((n) => (n.href === "/admin" ? path === "/admin" : path === n.href || path.startsWith(`${n.href}/`))).sort((a, b) => b.href.length - a.href.length)[0];