25 lines
717 B
JavaScript
25 lines
717 B
JavaScript
|
|
/**
|
||
|
|
* Kontrolle-Subnav (Mitai: settingsNav / analysis-split).
|
||
|
|
* Pfade müssen mit Routes in App.jsx übereinstimmen.
|
||
|
|
*
|
||
|
|
* @typedef {{ key: string, to: string, label: string }} ModeNavItem
|
||
|
|
*/
|
||
|
|
|
||
|
|
/** @type {ModeNavItem[]} */
|
||
|
|
export const CONTROL_NAV_ITEMS = [
|
||
|
|
{ key: 'status', to: '/control/status', label: 'Steuerung' },
|
||
|
|
{ key: 'journey', to: '/control/journey', label: 'Nachvollziehbarkeit' },
|
||
|
|
]
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param {string} pathname
|
||
|
|
* @returns {string | null}
|
||
|
|
*/
|
||
|
|
export function resolveControlNavActiveKey(pathname) {
|
||
|
|
const path = pathname.replace(/\/$/, '') || pathname
|
||
|
|
const match = CONTROL_NAV_ITEMS.find(
|
||
|
|
(item) => path === item.to || path.startsWith(`${item.to}/`),
|
||
|
|
)
|
||
|
|
return match?.key ?? null
|
||
|
|
}
|