import { useState, type ReactNode } from "react"; import { ArrowDown, ArrowUp, Check } from "lucide-react"; import { SelectTrigger } from "./SelectTrigger"; import { pickSort, type SortOption, type SortState } from "../../lib/columnSort"; import { PopoverItem, PopoverSurface } from "./AnchoredPopover"; import { useAnchoredPopover } from "./anchoredPopoverHooks"; import { SURFACE } from "./surfaces"; // The one sort control for every content surface (YT feed, Plex library, channel manager + its card // view, channel discovery, playlists): a labeled dropdown pill matching FilterSelect — `Label: key ↓ ▾` // — that opens a listbox of `SortOption`s with an asc/desc segment in the panel footer. Two-dimensional // (key + direction) unlike FilterSelect, so it stays its own component. Driven by the shared `SortState`. // `defaultLabel` opts a view into a "no sort" choice (tables); omit it for always-sorted views // (feed/Plex). `trailing` is an adornment slot (the feed's reshuffle, playlists' dirty-first toggle) // rendered in the footer beside the direction segment. // // Direction lives in the footer, not on the trigger, on purpose: the trigger stays a single plain // )} {trailing} )} ); }