Kairo-Jinkendo/frontend/src/components/ProgramScopeBar.jsx
Lars aa7e1626ea
Some checks failed
Test Suite / lint-backend (push) Waiting to run
Test Suite / compose-smoke (push) Waiting to run
Test Suite / k6 /api/health Baseline (push) Blocked by required conditions
Test Suite / playwright-smoke (push) Blocked by required conditions
Deploy Development / deploy (push) Successful in 42s
Test Suite / pytest-backend (push) Has been cancelled
AP1.9b: Scope-Breadcrumb modus-sensitiv für Planen, Ausführen und Kontrolle.
Portfolio- und Vorhaben-Klicks bleiben im aktiven Modus; Objekt-Routen leiten auf passende Plan-/Work-Hubs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 11:14:33 +02:00

76 lines
2.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { Link, useLocation } from 'react-router-dom'
import { useProgramScope } from '../context/ProgramScopeContext.jsx'
import { initiativeCatalogPath, projectPath, scopedPath } from '../utils/routes.js'
import {
resolveInitiativeHub,
resolvePortfolioHub,
} from '../utils/scopeNavigation.js'
export function ProgramScopeBar() {
const location = useLocation()
const {
initiativeId,
projectId,
initiativeTitle,
projectTitle,
clearScope,
setScope,
} = useProgramScope()
const portfolioTo = resolvePortfolioHub(location.pathname)
const initiativeTo = initiativeId
? resolveInitiativeHub(location.pathname, initiativeId, scopedPath)
: null
return (
<div className="program-scope-bar" aria-label="Programm-Scope">
<span className="program-scope-bar__label">Scope</span>
<nav className="program-scope-bar__trail">
<Link
to={portfolioTo}
className={
'program-scope-bar__crumb' +
(!initiativeId ? ' program-scope-bar__crumb--active' : '')
}
onClick={() => clearScope()}
>
Portfolio
</Link>
{initiativeId && initiativeTo && (
<>
<span className="program-scope-bar__sep" aria-hidden="true">
</span>
<Link
to={initiativeTo}
className={
'program-scope-bar__crumb' +
(!projectId ? ' program-scope-bar__crumb--active' : '')
}
onClick={() => setScope({ projectId: '', clearProject: true })}
>
{initiativeTitle || 'Vorhaben'}
</Link>
</>
)}
{projectId && (
<>
<span className="program-scope-bar__sep" aria-hidden="true">
</span>
<Link
to={projectPath(projectId)}
className="program-scope-bar__crumb program-scope-bar__crumb--active"
>
{projectTitle || 'Projekt'}
</Link>
</>
)}
</nav>
<Link to={initiativeCatalogPath()} className="program-scope-bar__catalog link-inline">
Vorhaben-Katalog
</Link>
</div>
)
}