AP1.9d: Methoden-Default-UI und Product Language für Product-Flow.
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 47s
Test Suite / pytest-backend (push) Has been cancelled
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 47s
Test Suite / pytest-backend (push) Has been cancelled
Prozessleiste, archetypgebundene Modus-Defaults und Sprint/Arbeitspaket-Begriffe schließen den GUI-Kern für continuous_product vor Sprint-Planungs-Flows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
82a5b9adec
commit
09826d146e
20 files changed
+796
-55
No files matched your search
@@ -0,0 +1,71 @@
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { getInitiative } from '../api/initiatives.js'
|
||||
import { getActiveWorkCycle } from '../api/workCycles.js'
|
||||
import { getInitiativeSteeringSnapshot } from '../api/initiatives.js'
|
||||
import { useProgramScope } from '../context/ProgramScopeContext.jsx'
|
||||
import { resolveMethodUiDefaults } from '../config/methodUiDefaults.js'
|
||||
|
||||
/**
|
||||
* Lädt Archetyp/Methode für methodengebundene UI (AP1.9d).
|
||||
*/
|
||||
export function useMethodUiContext() {
|
||||
const { initiativeId } = useProgramScope()
|
||||
const [archetypeKey, setArchetypeKey] = useState(null)
|
||||
const [methodKey, setMethodKey] = useState(null)
|
||||
const [hasActiveSprint, setHasActiveSprint] = useState(false)
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
if (!initiativeId) {
|
||||
setArchetypeKey(null)
|
||||
setMethodKey(null)
|
||||
setHasActiveSprint(false)
|
||||
return undefined
|
||||
}
|
||||
|
||||
let cancelled = false
|
||||
setLoading(true)
|
||||
|
||||
Promise.all([
|
||||
getInitiative(initiativeId),
|
||||
getActiveWorkCycle(initiativeId).catch(() => null),
|
||||
getInitiativeSteeringSnapshot(initiativeId).catch(() => null),
|
||||
])
|
||||
.then(([initiative, activeCycle, snapshot]) => {
|
||||
if (cancelled) return
|
||||
setArchetypeKey(initiative?.archetype_key || null)
|
||||
setMethodKey(snapshot?.method_key || null)
|
||||
setHasActiveSprint(Boolean(activeCycle?.id))
|
||||
})
|
||||
.catch(() => {
|
||||
if (!cancelled) {
|
||||
setArchetypeKey(null)
|
||||
setMethodKey(null)
|
||||
setHasActiveSprint(false)
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setLoading(false)
|
||||
})
|
||||
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [initiativeId])
|
||||
|
||||
const input = useMemo(
|
||||
() => ({ archetypeKey, methodKey, hasActiveSprint }),
|
||||
[archetypeKey, methodKey, hasActiveSprint],
|
||||
)
|
||||
|
||||
const defaults = useMemo(() => resolveMethodUiDefaults(input), [input])
|
||||
|
||||
return {
|
||||
initiativeId,
|
||||
archetypeKey,
|
||||
methodKey,
|
||||
hasActiveSprint,
|
||||
loading,
|
||||
...defaults,
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user