2026-07-05 06:41:23 +02:00
|
|
|
import { WorkspacePage } from '../pages/WorkspacePage.jsx'
|
|
|
|
|
import { InitiativesPage } from '../pages/InitiativesPage.jsx'
|
2026-07-05 06:58:48 +02:00
|
|
|
import { MyActionsPage } from '../pages/MyActionsPage.jsx'
|
2026-07-05 06:41:23 +02:00
|
|
|
|
2026-07-05 06:58:48 +02:00
|
|
|
/** @type {import('./viewRegistry.js').ViewDefinition[]} */
|
2026-07-05 06:41:23 +02:00
|
|
|
export const VIEWS = [
|
|
|
|
|
{
|
|
|
|
|
key: 'kairo.workspace',
|
|
|
|
|
path: '/workspace',
|
|
|
|
|
title: 'Workspace',
|
2026-07-05 06:58:48 +02:00
|
|
|
navLabel: 'Workspace',
|
|
|
|
|
shortLabel: 'Start',
|
2026-07-05 06:41:23 +02:00
|
|
|
requiredCapability: 'kairo.action.read',
|
|
|
|
|
component: WorkspacePage,
|
|
|
|
|
showInNav: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'kairo.initiatives',
|
|
|
|
|
path: '/initiatives',
|
|
|
|
|
title: 'Vorhaben',
|
2026-07-05 06:58:48 +02:00
|
|
|
navLabel: 'Vorhaben',
|
|
|
|
|
shortLabel: 'Vorhaben',
|
|
|
|
|
matchPrefix: '/initiatives',
|
2026-07-05 06:41:23 +02:00
|
|
|
requiredCapability: 'kairo.initiative.read',
|
|
|
|
|
component: InitiativesPage,
|
|
|
|
|
showInNav: true,
|
|
|
|
|
},
|
2026-07-05 06:58:48 +02:00
|
|
|
{
|
|
|
|
|
key: 'kairo.my_actions',
|
|
|
|
|
path: '/my-actions',
|
|
|
|
|
title: 'Meine Maßnahmen',
|
|
|
|
|
navLabel: 'Meine Maßnahmen',
|
|
|
|
|
shortLabel: 'Maßnahmen',
|
|
|
|
|
requiredCapability: 'kairo.action.read',
|
|
|
|
|
component: MyActionsPage,
|
|
|
|
|
showInNav: true,
|
|
|
|
|
},
|
2026-07-05 06:41:23 +02:00
|
|
|
]
|
|
|
|
|
|
2026-07-05 06:58:48 +02:00
|
|
|
/**
|
|
|
|
|
* @typedef {Object} ViewDefinition
|
|
|
|
|
* @property {string} key
|
|
|
|
|
* @property {string} path
|
|
|
|
|
* @property {string} title
|
|
|
|
|
* @property {string} [navLabel]
|
|
|
|
|
* @property {string} [shortLabel]
|
|
|
|
|
* @property {string} [matchPrefix]
|
|
|
|
|
* @property {string} [requiredCapability]
|
|
|
|
|
* @property {import('react').ComponentType<any>} component
|
|
|
|
|
* @property {boolean} [showInNav]
|
|
|
|
|
*/
|
|
|
|
|
|
2026-07-05 06:41:23 +02:00
|
|
|
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)
|
|
|
|
|
}
|