import type { SessionBrowseGroupBy, SessionBrowseSortBy } from "../../lib/sessions-group"; import type { SessionBrowseStatus } from "../../lib/session-browse-preferences"; import { DropdownMenuCheckboxItem, DropdownMenuMeta, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, } from "../../../ui/dropdown-menu"; const GROUPS: Record = { activity: "Last activity", project: "Project", none: "None", created: "Created date", creator: "Creator", }; const SORTS: Record = { updatedAt: "Last activity", createdAt: "Created date", name: "Name", }; const STATUSES: Record = { active: "Active", "needs-you": "Needs you", archived: "Archived", all: "All", }; function ViewSubmenu({ label, value, choices, counts, onChange, }: { label: string; value: T; choices: Record; /** A quiet number beside a choice, shown only when positive. */ counts?: Partial> | undefined; onChange: (value: T) => void; }) { return ( {label} {choices[value]} onChange(next as T)} > {(Object.keys(choices) as T[]).map((choice) => ( {choices[choice]} {counts?.[choice] ? ( {counts[choice]} ) : null} ))} ); } export function SessionBrowseOrderControls({ groupBy, onGroupByChange, sortBy, onSortByChange, status, onStatusChange, needsYouCount = 0, mineOnly, onMineOnlyChange, showEmptyGroups, onShowEmptyGroupsChange, }: { groupBy: SessionBrowseGroupBy; onGroupByChange: (value: SessionBrowseGroupBy) => void; sortBy: SessionBrowseSortBy; onSortByChange: (value: SessionBrowseSortBy) => void; status: SessionBrowseStatus; onStatusChange: (value: SessionBrowseStatus) => void; /** Authorized active workstreams waiting on the person, counted beside "Needs you". */ needsYouCount?: number | undefined; /** Only workstreams the person started or messaged. */ mineOnly: boolean; onMineOnlyChange: (value: boolean) => void; showEmptyGroups: boolean; onShowEmptyGroupsChange: (value: boolean) => void; }) { return ( <> onMineOnlyChange(checked === true)} > Only mine onShowEmptyGroupsChange(checked === true)} > Show empty groups ); }