import { CockpitPage } from '../pages/modes/CockpitPage.jsx' import { WorkLayout, WorkIndexRedirect } from '../pages/modes/WorkLayout.jsx' import { WorkTodayPage } from '../pages/modes/WorkTodayPage.jsx' import { WorkMinePage } from '../pages/modes/WorkMinePage.jsx' import { PlanLayout, PlanIndexRedirect } from '../pages/modes/PlanLayout.jsx' import { PlanStructurePage } from '../pages/modes/PlanStructurePage.jsx' import { PlanGatesPage } from '../pages/modes/PlanGatesPage.jsx' import { PlanInboxPage } from '../pages/modes/PlanInboxPage.jsx' import { PlanWorkPage } from '../pages/modes/PlanWorkPage.jsx' import { PlanProfilePage } from '../pages/modes/PlanProfilePage.jsx' import { PlanPortfolioPage } from '../pages/modes/PlanPortfolioPage.jsx' import { ControlLayout, ControlIndexRedirect } from '../pages/modes/ControlLayout.jsx' import { ControlStatusPage } from '../pages/modes/ControlStatusPage.jsx' import { ControlJourneyPage } from '../pages/modes/ControlJourneyPage.jsx' import { TeamPage } from '../pages/modes/TeamPage.jsx' import { InitiativesPage } from '../pages/InitiativesPage.jsx' /** @type {import('./viewRegistry.js').ViewDefinition[]} */ export const VIEWS = [ { key: 'kairo.cockpit', path: '/cockpit', title: 'Cockpit', navLabel: 'Cockpit', shortLabel: 'Cockpit', matchPrefix: '/cockpit', requiredCapability: 'kairo.action.read', component: CockpitPage, showInNav: true, }, { key: 'kairo.work', path: '/work', title: 'Ausführen', navLabel: 'Ausführen', shortLabel: 'Arbeit', matchPrefix: '/work', objectPrefixes: ['/actions'], requiredCapability: 'kairo.action.read', component: WorkLayout, showInNav: true, }, { key: 'kairo.plan', path: '/plan', title: 'Planen', navLabel: 'Planen', shortLabel: 'Plan', matchPrefix: '/plan', objectPrefixes: ['/projects', '/gates'], requiredCapability: 'kairo.initiative.read', component: PlanLayout, showInNav: true, }, { key: 'kairo.control', path: '/control', title: 'Kontrolle', navLabel: 'Kontrolle', shortLabel: 'Kontrolle', matchPrefix: '/control', requiredCapability: 'kairo.initiative.read', component: ControlLayout, showInNav: true, }, { key: 'kairo.team', path: '/team', title: 'Team', navLabel: 'Team', shortLabel: 'Team', matchPrefix: '/team', requiredCapability: 'kairo.action.read', component: TeamPage, showInNav: true, }, { key: 'kairo.initiatives', path: '/initiatives', title: 'Vorhaben', navLabel: 'Vorhaben', shortLabel: 'Vorhaben', matchPrefix: '/initiatives', requiredCapability: 'kairo.initiative.read', component: InitiativesPage, showInNav: true, }, { key: 'kairo.workspace', path: '/workspace', title: 'Workspace', component: CockpitPage, showInNav: false, }, { key: 'kairo.my_actions', path: '/my-actions', title: 'Meine Maßnahmen', component: WorkMinePage, showInNav: false, }, ] /** * @typedef {Object} ViewDefinition * @property {string} key * @property {string} path * @property {string} title * @property {string} [navLabel] * @property {string} [shortLabel] * @property {string} [matchPrefix] * @property {string[]} [objectPrefixes] * @property {string} [requiredCapability] * @property {import('react').ComponentType} component * @property {boolean} [showInNav] */ export function getNavViews(capabilities) { const capSet = capabilities instanceof Set ? capabilities : new Set(capabilities) return VIEWS.filter((v) => v.showInNav !== false) .filter((v) => !v.requiredCapability || capSet.has(v.requiredCapability)) } export function getViewByKey(key) { return VIEWS.find((v) => v.key === key) } export const MODE_ROUTE_COMPONENTS = { workToday: WorkTodayPage, workMine: WorkMinePage, planPortfolio: PlanPortfolioPage, planProfile: PlanProfilePage, planStructure: PlanStructurePage, planGates: PlanGatesPage, planInbox: PlanInboxPage, planWork: PlanWorkPage, controlStatus: ControlStatusPage, controlJourney: ControlJourneyPage, } export { WorkLayout, WorkIndexRedirect, PlanLayout, PlanIndexRedirect, ControlLayout, ControlIndexRedirect, }