Kairo-Jinkendo/frontend/src/plan/planOutlineNodes.js

28 lines
1.0 KiB
JavaScript
Raw Normal View History

/**
* Top-level Plan-Outline-Knoten (AP1.12a).
* Unterknoten (Projekt-Baum, Gate-Graph) folgen in AP1.12b+.
*
* @typedef {{ key: string, to: string, label: string, requiresInitiative?: boolean, disabled?: boolean, hint?: string }} PlanOutlineNode
*/
/** @type {PlanOutlineNode[]} */
export const PLAN_OUTLINE_NODES = [
{ key: 'profile', to: '/plan/profile', label: 'Profil', requiresInitiative: true },
{ key: 'structure', to: '/plan/structure', label: 'Struktur', requiresInitiative: true },
{ key: 'gates', to: '/plan/gates', label: 'Zielzustände', requiresInitiative: true },
{ key: 'inbox', to: '/plan/inbox', label: 'Eingang', requiresInitiative: true },
{ key: 'work', to: '/plan/work', label: 'Arbeit', requiresInitiative: true },
]
/**
* @param {string} pathname
* @returns {string | null}
*/
export function resolvePlanOutlineActiveKey(pathname) {
const path = pathname.replace(/\/$/, '') || pathname
const match = PLAN_OUTLINE_NODES.find(
(node) => path === node.to || path.startsWith(`${node.to}/`),
)
return match?.key ?? null
}