import { LayoutDashboard, Settings, UserCog, CreditCard, // People (Members + Access) UserCheck, // Courses GraduationCap, CalendarDays, MapPin, UserRound, // Events CalendarHeart, Ticket, PartyPopper, // Bookings Hotel, BedDouble, Contact, CalendarRange, // Finance Wallet, Receipt, Landmark, BarChart3, // Documents FileText, FilePlus, FileStack, FolderOpen, // Newsletter Mail, MailPlus, FileCode, // Site Builder PanelTop, Newspaper, Palette, // Fisheries Fish, Waves, Anchor, BookOpen, ShieldCheck, Trophy, // Meetings BookMarked, ListChecks, ScrollText, // Association (Verband) Building2, Network, SearchCheck, Share2, PieChart, LayoutTemplate, // Modules Database, } from 'lucide-react'; import { NavigationConfigSchema } from '@kit/ui/navigation-schema'; import featureFlagsConfig from '~/config/feature-flags.config'; import pathsConfig from '~/config/paths.config'; const iconClasses = 'w-4'; const getRoutes = ( account: string, accountFeatures?: Record, ) => { const routes: Array< | { label: string; collapsible?: boolean; collapsed?: boolean; children: Array< | { label: string; path: string; Icon: React.ReactNode; highlightMatch?: string; } | undefined >; } | { divider: true } > = [ // ── Dashboard ── { label: 'common.routes.dashboard', children: [ { label: 'common.routes.dashboard', path: pathsConfig.app.accountHome.replace('[account]', account), Icon: , highlightMatch: `${pathsConfig.app.home}$`, }, ], }, ]; // ── People (Members + Access) ── { const peopleChildren: Array<{ label: string; path: string; Icon: React.ReactNode; }> = []; if (featureFlagsConfig.enableMemberManagement) { peopleChildren.push({ label: 'common.routes.clubMembers', path: createPath(pathsConfig.app.accountCmsMembers, account), Icon: , }); } // Admin users who can log in — always visible peopleChildren.push({ label: 'common.routes.accessAndRoles', path: createPath(pathsConfig.app.accountMembers, account), Icon: , }); routes.push({ label: 'common.routes.people', collapsible: true, children: peopleChildren, }); } // ── Courses ── if (featureFlagsConfig.enableCourseManagement) { routes.push({ label: 'common.routes.courseManagement', collapsible: true, children: [ { label: 'common.routes.courseList', path: createPath(pathsConfig.app.accountCourses, account), Icon: , }, { label: 'common.routes.courseCalendar', path: createPath( pathsConfig.app.accountCourses + '/calendar', account, ), Icon: , }, { label: 'common.routes.courseInstructors', path: createPath( pathsConfig.app.accountCourses + '/instructors', account, ), Icon: , }, { label: 'common.routes.courseLocations', path: createPath( pathsConfig.app.accountCourses + '/locations', account, ), Icon: , }, ], }); } // ── Events ── routes.push({ label: 'common.routes.eventManagement', collapsible: true, children: [ { label: 'common.routes.eventList', path: createPath('/home/[account]/events', account), Icon: , }, { label: 'common.routes.eventRegistrations', path: createPath('/home/[account]/events/registrations', account), Icon: , }, { label: 'common.routes.holidayPasses', path: createPath('/home/[account]/events/holiday-passes', account), Icon: , }, ], }); // ── Bookings ── if (featureFlagsConfig.enableBookingManagement) { routes.push({ label: 'common.routes.bookingManagement', collapsible: true, collapsed: true, children: [ { label: 'common.routes.bookingList', path: createPath(pathsConfig.app.accountBookings, account), Icon: , }, { label: 'common.routes.bookingCalendar', path: createPath( pathsConfig.app.accountBookings + '/calendar', account, ), Icon: , }, { label: 'common.routes.bookingRooms', path: createPath(pathsConfig.app.accountBookings + '/rooms', account), Icon: , }, { label: 'common.routes.bookingGuests', path: createPath( pathsConfig.app.accountBookings + '/guests', account, ), Icon: , }, ], }); } // ── Finance ── if (featureFlagsConfig.enableSepaPayments) { routes.push({ label: 'common.routes.financeManagement', collapsible: true, collapsed: true, children: [ { label: 'common.routes.financeOverview', path: createPath(pathsConfig.app.accountFinance, account), Icon: , }, { label: 'common.routes.financeInvoices', path: createPath( pathsConfig.app.accountFinance + '/invoices', account, ), Icon: , }, { label: 'common.routes.financeSepa', path: createPath(pathsConfig.app.accountFinance + '/sepa', account), Icon: , }, { label: 'common.routes.financePayments', path: createPath( pathsConfig.app.accountFinance + '/payments', account, ), Icon: , }, ], }); } // ── Documents ── if (featureFlagsConfig.enableDocumentGeneration) { routes.push({ label: 'common.routes.documentManagement', collapsible: true, collapsed: true, children: [ { label: 'common.routes.documentOverview', path: createPath(pathsConfig.app.accountDocuments, account), Icon: , }, { label: 'common.routes.documentGenerate', path: createPath( pathsConfig.app.accountDocuments + '/generate', account, ), Icon: , }, { label: 'common.routes.documentTemplates', path: createPath( pathsConfig.app.accountDocuments + '/templates', account, ), Icon: , }, { label: 'common.routes.files', path: createPath(pathsConfig.app.accountFiles, account), Icon: , }, ], }); } // ── Newsletter ── if (featureFlagsConfig.enableNewsletter) { routes.push({ label: 'common.routes.newsletterManagement', collapsible: true, collapsed: true, children: [ { label: 'common.routes.newsletterCampaigns', path: createPath(pathsConfig.app.accountNewsletter, account), Icon: , }, { label: 'common.routes.newsletterNew', path: createPath(pathsConfig.app.accountNewsletter + '/new', account), Icon: , }, { label: 'common.routes.newsletterTemplates', path: createPath( pathsConfig.app.accountNewsletter + '/templates', account, ), Icon: , }, ], }); } // ── Site Builder ── if (featureFlagsConfig.enableSiteBuilder) { routes.push({ label: 'common.routes.siteBuilder', collapsible: true, collapsed: true, children: [ { label: 'common.routes.sitePages', path: createPath(pathsConfig.app.accountSiteBuilder, account), Icon: , }, { label: 'common.routes.sitePosts', path: createPath( pathsConfig.app.accountSiteBuilder + '/posts', account, ), Icon: , }, { label: 'common.routes.siteSettings', path: createPath( pathsConfig.app.accountSiteBuilder + '/settings', account, ), Icon: , }, ], }); } // ── Custom Modules ── if (featureFlagsConfig.enableModuleBuilder) { routes.push({ label: 'common.routes.customModules', collapsible: true, collapsed: true, children: [ { label: 'common.routes.moduleList', path: createPath(pathsConfig.app.accountModules, account), Icon: , }, ], }); } // ── Fisheries ── if ( featureFlagsConfig.enableFischerei && accountFeatures?.fischerei !== false ) { routes.push({ label: 'common.routes.fisheriesManagement', collapsible: true, collapsed: true, children: [ { label: 'common.routes.fisheriesOverview', path: createPath(pathsConfig.app.accountFischerei, account), Icon: , }, { label: 'common.routes.fisheriesWaters', path: createPath( pathsConfig.app.accountFischerei + '/waters', account, ), Icon: , }, { label: 'common.routes.fisheriesLeases', path: createPath( pathsConfig.app.accountFischerei + '/leases', account, ), Icon: , }, { label: 'common.routes.fisheriesCatchBooks', path: createPath( pathsConfig.app.accountFischerei + '/catch-books', account, ), Icon: , }, { label: 'common.routes.fisheriesPermits', path: createPath( pathsConfig.app.accountFischerei + '/permits', account, ), Icon: , }, { label: 'common.routes.fisheriesCompetitions', path: createPath( pathsConfig.app.accountFischerei + '/competitions', account, ), Icon: , }, ], }); } // ── Meeting Protocols ── if ( featureFlagsConfig.enableMeetingProtocols && accountFeatures?.meetings !== false ) { routes.push({ label: 'common.routes.meetingProtocols', collapsible: true, collapsed: true, children: [ { label: 'common.routes.meetingsOverview', path: createPath(pathsConfig.app.accountMeetings, account), Icon: , }, { label: 'common.routes.meetingsProtocols', path: createPath( pathsConfig.app.accountMeetings + '/protocols', account, ), Icon: , }, { label: 'common.routes.meetingsTasks', path: createPath(pathsConfig.app.accountMeetings + '/tasks', account), Icon: , }, ], }); } // ── Association Management (Verband) ── if ( featureFlagsConfig.enableVerbandsverwaltung && accountFeatures?.verband !== false ) { routes.push({ label: 'common.routes.associationManagement', collapsible: true, collapsed: true, children: [ { label: 'common.routes.associationOverview', path: createPath(pathsConfig.app.accountVerband, account), Icon: , }, { label: 'common.routes.associationHierarchy', path: createPath( pathsConfig.app.accountVerband + '/hierarchy', account, ), Icon: , }, { label: 'common.routes.associationMemberSearch', path: createPath( pathsConfig.app.accountVerband + '/members', account, ), Icon: , }, { label: 'common.routes.associationEvents', path: createPath(pathsConfig.app.accountVerband + '/events', account), Icon: , }, { label: 'common.routes.associationReporting', path: createPath( pathsConfig.app.accountVerband + '/reporting', account, ), Icon: , }, { label: 'common.routes.associationTemplates', path: createPath( pathsConfig.app.accountVerband + '/templates', account, ), Icon: , }, ], }); } // ── Administration ── routes.push({ label: 'common.routes.administration', collapsible: false, children: [ { label: 'common.routes.accountSettings', path: createPath(pathsConfig.app.accountSettings, account), Icon: , }, featureFlagsConfig.enableTeamAccountBilling ? { label: 'common.routes.billing', path: createPath(pathsConfig.app.accountBilling, account), Icon: , } : undefined, ], }); return routes; }; export function getTeamAccountSidebarConfig( account: string, accountFeatures?: Record, ) { return NavigationConfigSchema.parse({ routes: getRoutes(account, accountFeatures), style: process.env.NEXT_PUBLIC_TEAM_NAVIGATION_STYLE, sidebarCollapsed: process.env.NEXT_PUBLIC_TEAM_SIDEBAR_COLLAPSED, sidebarCollapsedStyle: process.env.NEXT_PUBLIC_SIDEBAR_COLLAPSIBLE_STYLE, }); } function createPath(path: string, account: string) { return path.replace('[account]', account); }