chore: added recursive goals to monitor page

This commit is contained in:
Pim Hutting
2026-01-20 12:31:34 +01:00
parent 2ca0c9c4c0
commit a8f9965391
3 changed files with 61 additions and 6 deletions

View File

@@ -306,14 +306,17 @@ function PhaseDashboard({
setActiveIds: React.Dispatch<React.SetStateAction<Record<string, boolean>>>,
goalIndex: number
}) {
const getGoals = useProgramStore((s) => s.getGoalsInPhase);
const getGoalsWithDepth = useProgramStore((s) => s.getGoalsWithDepth);
const getTriggers = useProgramStore((s) => s.getTriggersInPhase);
const getNorms = useProgramStore((s) => s.getNormsInPhase);
// Prepare data view models
const goals = (getGoals(phaseId) as GoalNode[]).map(g => ({
const goals = getGoalsWithDepth(phaseId).map((g) => ({
...g,
achieved: activeIds[g.id] ?? false,
id: g.id as string,
name: g.name as string,
achieved: activeIds[g.id as string] ?? false,
level: g.level, // Pass this new property to the UI
}));
const triggers = (getTriggers(phaseId) as TriggerNode[]).map(t => ({