diff --git a/components/shared/sprint-switcher.tsx b/components/shared/sprint-switcher.tsx index 11fa596..e718a42 100644 --- a/components/shared/sprint-switcher.tsx +++ b/components/shared/sprint-switcher.tsx @@ -18,6 +18,7 @@ import { switchActiveSprintAction, } from '@/actions/active-sprint' import { useProductWorkspaceStore } from '@/stores/product-workspace/store' +import { deriveScreenState } from '@/stores/product-workspace/screen-state' import { useUserSettingsStore } from '@/stores/user-settings/store' import type { SprintStatusApi } from '@/lib/task-status' import { debugProps } from '@/lib/debug' @@ -57,6 +58,20 @@ export function SprintSwitcher({ const draftGoal = useUserSettingsStore( (s) => s.entities.settings.workflow?.pendingSprintDraft?.[productId]?.goal ?? null, ) + const pendingAdds = useProductWorkspaceStore( + (s) => s.sprintMembership.pending.adds, + ) + const pendingRemoves = useProductWorkspaceStore( + (s) => s.sprintMembership.pending.removes, + ) + + const screenState = deriveScreenState({ + activeSprintItem: activeSprint, + buildingSprintIds, + hasPendingDraft: draftGoal !== null, + pendingAdds, + pendingRemoves, + }) const visibleSprints = sprints.filter(s => { if (showClosed) return true @@ -139,10 +154,19 @@ export function SprintSwitcher({ disabled={isPending} className="flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors px-2 py-1 rounded-md hover:bg-surface-container focus:outline-none" > - - {activeSprint ? activeSprint.code : 'Selecteer sprint'} + + {screenState.kind === 'DRAFT' + ? `⚙ Concept — ${draftGoal}` + : activeSprint + ? activeSprint.code + : 'Selecteer sprint'} - {activeSprint && ( + {screenState.kind !== 'DRAFT' && activeSprint && (