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 46s
Test Suite / pytest-backend (push) Has been cancelled
Initiative-API fuer Roadmap-Dependencies, SVG-Layout mit Liste/Graph-Umschalter auf der Zielzustaende-Seite. Co-authored-by: Cursor <cursoragent@cursor.com>
69 lines
1.9 KiB
JavaScript
69 lines
1.9 KiB
JavaScript
import { useEffect, useState } from 'react'
|
|
import { RoadmapPlanSection } from './RoadmapPlanSection.jsx'
|
|
import { GateMapView } from './GateMapView.jsx'
|
|
import { resolveGatesViewMode, storeGatesViewMode } from '../plan/gateGraphLayout.js'
|
|
|
|
export function GatesPlanPanel({
|
|
initiativeId,
|
|
items,
|
|
canManage,
|
|
onCreate,
|
|
onReorder,
|
|
onDelete,
|
|
busy,
|
|
}) {
|
|
const [viewMode, setViewMode] = useState(() => resolveGatesViewMode(initiativeId, items.length))
|
|
|
|
useEffect(() => {
|
|
setViewMode(resolveGatesViewMode(initiativeId, items.length))
|
|
}, [initiativeId, items.length])
|
|
|
|
function handleViewChange(mode) {
|
|
setViewMode(mode)
|
|
storeGatesViewMode(initiativeId, mode)
|
|
}
|
|
|
|
return (
|
|
<div className="gates-plan-panel">
|
|
<div className="gates-plan-panel__toolbar" role="tablist" aria-label="Zielzustände Ansicht">
|
|
<button
|
|
type="button"
|
|
role="tab"
|
|
aria-selected={viewMode === 'list'}
|
|
className={
|
|
'gates-plan-panel__tab' + (viewMode === 'list' ? ' gates-plan-panel__tab--active' : '')
|
|
}
|
|
onClick={() => handleViewChange('list')}
|
|
>
|
|
Liste
|
|
</button>
|
|
<button
|
|
type="button"
|
|
role="tab"
|
|
aria-selected={viewMode === 'graph'}
|
|
className={
|
|
'gates-plan-panel__tab' + (viewMode === 'graph' ? ' gates-plan-panel__tab--active' : '')
|
|
}
|
|
onClick={() => handleViewChange('graph')}
|
|
>
|
|
Graph
|
|
</button>
|
|
</div>
|
|
|
|
{viewMode === 'list' ? (
|
|
<RoadmapPlanSection
|
|
initiativeId={initiativeId}
|
|
items={items}
|
|
canManage={canManage}
|
|
onCreate={onCreate}
|
|
onReorder={onReorder}
|
|
onDelete={onDelete}
|
|
busy={busy}
|
|
/>
|
|
) : (
|
|
<GateMapView initiativeId={initiativeId} items={items} />
|
|
)}
|
|
</div>
|
|
)
|
|
}
|