From d90d8a8aa2a5bff5231e9a85cbc56057486c777b Mon Sep 17 00:00:00 2001 From: Madhura68 Date: Fri, 8 May 2026 01:57:59 +0200 Subject: [PATCH] feat: filter 'toon afgeronde sprints' in sprint-switcher dropdown Default verbergt de switcher gesloten/gearchiveerde/mislukte sprints (toont alleen open + de huidige actieve sprint). Toggle bovenaan de lijst om alle sprints te tonen. Co-Authored-By: Claude Opus 4.7 (1M context) --- components/shared/sprint-switcher.tsx | 67 ++++++++++++++++++++------- 1 file changed, 50 insertions(+), 17 deletions(-) diff --git a/components/shared/sprint-switcher.tsx b/components/shared/sprint-switcher.tsx index d000426..28edcd6 100644 --- a/components/shared/sprint-switcher.tsx +++ b/components/shared/sprint-switcher.tsx @@ -1,14 +1,15 @@ 'use client' import { usePathname, useRouter } from 'next/navigation' -import { useTransition } from 'react' -import { ChevronDown } from 'lucide-react' +import { useState, useTransition } from 'react' +import { Check, ChevronDown } from 'lucide-react' import { toast } from 'sonner' import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip' import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, + DropdownMenuSeparator, DropdownMenuTrigger, } from '@/components/ui/dropdown-menu' import { cn } from '@/lib/utils' @@ -40,8 +41,15 @@ export function SprintSwitcher({ const pathname = usePathname() const router = useRouter() const [isPending, startTransition] = useTransition() + const [showClosed, setShowClosed] = useState(false) const buildingSet = new Set(buildingSprintIds) + const visibleSprints = sprints.filter(s => { + if (showClosed) return true + if (s.id === activeSprint?.id) return true + return s.status === 'open' + }) + function handleSwitchSprint(sprintId: string) { if (sprintId === activeSprint?.id) return startTransition(async () => { @@ -96,27 +104,52 @@ export function SprintSwitcher({ - {sprints.map(s => ( - handleSwitchSprint(s.id)} + + + {visibleSprints.length === 0 ? ( +
+ Geen open sprints +
+ ) : ( + visibleSprints.map(s => ( + handleSwitchSprint(s.id)} className={cn( - 'text-[10px] shrink-0', - buildingSet.has(s.id) ? 'text-warning' : 'text-muted-foreground', + 'flex items-center gap-2', + s.id === activeSprint?.id && 'bg-primary-container text-primary-container-foreground font-medium', )} > - {buildingSet.has(s.id) ? 'BUILDING' : SPRINT_STATUS_LABEL[s.status]} - - - ))} + {s.code} + {s.sprint_goal} + + {buildingSet.has(s.id) ? 'BUILDING' : SPRINT_STATUS_LABEL[s.status]} + +
+ )) + )}
)