25 lines
683 B
JavaScript
25 lines
683 B
JavaScript
|
|
/**
|
||
|
|
* Ausführen-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 WORK_NAV_ITEMS = [
|
||
|
|
{ key: 'today', to: '/work/today', label: 'Heute' },
|
||
|
|
{ key: 'mine', to: '/work/mine', label: 'Meine Queue' },
|
||
|
|
]
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @param {string} pathname
|
||
|
|
* @returns {string | null}
|
||
|
|
*/
|
||
|
|
export function resolveWorkNavActiveKey(pathname) {
|
||
|
|
const path = pathname.replace(/\/$/, '') || pathname
|
||
|
|
const match = WORK_NAV_ITEMS.find(
|
||
|
|
(item) => path === item.to || path.startsWith(`${item.to}/`),
|
||
|
|
)
|
||
|
|
return match?.key ?? null
|
||
|
|
}
|