feat(ST-n1csfo4j): handleAllDone + AlertDialog + Alles-op-done knop in sprint-afronden-dialog

Voegt handleAllDone toe (roept setAllSprintTasksDoneAction aan en zet alle
per-story decisions op DONE in de UI), een bevestigende AlertDialog en een
'Alles op done'-knop bovenaan de story-lijst in de sprint-afronden-dialog.
Voegt setAllSprintTasksDoneAction ook toe aan actions/sprints.ts omdat die
branch nog niet op main staat.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scrum4Me Agent 2026-05-06 06:27:21 +02:00
parent 33c7c03a67
commit ac944ed5d2
2 changed files with 75 additions and 0 deletions

View file

@ -114,6 +114,20 @@ export function SprintHeader({ productId, productName, sprint, isDemo, sprintSto
})
}
function handleAllDone() {
startSettingAllDone(async () => {
const result = await setAllSprintTasksDoneAction(sprint.id)
if (!result.ok) {
toast.error(result.error ?? 'Alles op done mislukt')
} else {
const allDone: Record<string, 'DONE' | 'OPEN'> = {}
sprintStories.forEach(s => { allDone[s.id] = 'DONE' })
setDecisions(allDone)
}
setShowAllDoneConfirm(false)
})
}
return (
<div className="px-4 py-3 border-b border-border bg-surface-container-low shrink-0">
<div className="flex items-center justify-between gap-4">
@ -220,6 +234,18 @@ export function SprintHeader({ productId, productName, sprint, isDemo, sprintSto
<p className="text-sm text-muted-foreground">
Geef per story aan wat er mee moet gebeuren:
</p>
<div className="flex justify-end">
<Button
type="button"
size="sm"
variant="outline"
className="border-status-done/40 text-status-done hover:bg-status-done/10"
disabled={isSettingAllDone || isCompleting}
onClick={() => setShowAllDoneConfirm(true)}
>
{isSettingAllDone ? 'Bezig…' : 'Alles op done'}
</Button>
</div>
<div className="space-y-2">
{sprintStories.map(story => (
<div key={story.id} className="flex items-center justify-between gap-3 p-2 bg-surface-container-low rounded-lg">
@ -257,6 +283,26 @@ export function SprintHeader({ productId, productName, sprint, isDemo, sprintSto
</div>
</DialogContent>
</Dialog>
<AlertDialog open={showAllDoneConfirm} onOpenChange={setShowAllDoneConfirm}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Alles op done zetten?</AlertDialogTitle>
<AlertDialogDescription>
Alle taken én stories in de sprint inclusief taken met status
REVIEW worden op DONE gezet. De per-story toggles hieronder
worden daarna bijgewerkt. Je kunt daarna nog per story aanpassen
vóór je de sprint afrondt.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel disabled={isSettingAllDone}>Annuleren</AlertDialogCancel>
<AlertDialogAction onClick={handleAllDone} disabled={isSettingAllDone}>
{isSettingAllDone ? 'Bezig…' : 'Alles op done'}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
)
}