import { Check, ChevronDown } from "lucide-react"; import { Button } from "@/components/ui/button"; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import { TASK_VIEW_GROUPS, taskView, type TaskViewKey } from "@/lib/task-views"; import { cn } from "@/lib/utils"; /** * The single control that replaced both the Inbox tab bar and the implicit * "all tasks" default on Tasks (PAP-670). One menu, grouped by scope, so the * nav does not have to grow a row every time a view is added. */ export function TaskViewsMenu({ value, onChange, badgeCount, }: { value: TaskViewKey; onChange: (next: TaskViewKey) => void; /** Unread count surfaced next to the My-work group, mirroring the nav badge. */ badgeCount?: number; }) { const active = taskView(value); return ( {TASK_VIEW_GROUPS.map((group, groupIndex) => (
{groupIndex > 0 ? : null} {group.label} {groupIndex === 0 && badgeCount != null && badgeCount > 0 ? ( {badgeCount > 99 ? "99+" : badgeCount} ) : null} {group.views.map((view) => { const selected = view.key === value; return ( onChange(view.key)} className="items-start gap-2" aria-current={selected ? "true" : undefined} > ); })}
))}
); }