shinkan-jinkendo/frontend/src/config/appNav.js

50 lines
1.4 KiB
JavaScript
Raw Normal View History

import {
LayoutDashboard,
BookOpen,
Calendar,
Building2,
Settings,
Shield,
Target,
Inbox
} from 'lucide-react'
/**
* Shinkan Navigation Configuration
* Single source of truth für Bottom-Nav (Mobile) + Desktop-Sidebar
*
* @typedef {{ to: string, label: string, shortLabel?: string, end?: boolean, Icon: import('react').ForwardRefExoticComponent }} AppNavItem
*/
/** @param {{ showInbox?: boolean }} opts */
function baseItems(opts = {}) {
const showInbox = !!opts.showInbox
const items = [
{ to: '/', label: 'Übersicht', end: true },
...(showInbox ? [{ to: '/inbox', label: 'Posteingang', shortLabel: 'Post' }] : []),
{ to: '/exercises', label: 'Übungen', shortLabel: 'Übungen' },
{ to: '/planning', label: 'Planung' },
{ to: '/clubs', label: 'Vereine' },
{ to: '/trainer-contexts', label: 'Meine Bereiche', shortLabel: 'Bereiche' },
{ to: '/settings', label: 'Einstellungen', shortLabel: 'Einst.' }
]
return items
}
/** @param {boolean} isAdmin @param {{ showInbox?: boolean }} opts */
export function getMainNavItems(isAdmin, opts = {}) {
const showInbox = !!opts.showInbox
const icons = [LayoutDashboard, ...(showInbox ? [Inbox] : []), BookOpen, Calendar, Building2, Target, Settings]
const raw = baseItems(opts).map((item, i) => ({
...item,
Icon: icons[i]
}))
if (isAdmin) {
raw.push({ to: '/admin', label: 'Admin', end: false, Icon: Shield })
}
return raw
}