import type { Tag } from "../lib/api"; import type { ComboboxOption } from "./ui/Combobox"; // A tag as a filter row: its count is the CURRENT filter's (the summary's facets), or none at all while // the facets load or after they failed. The rail printed the tag's whole-library count in that gap, as // if it were the filter's: "Music 238" beside a search that matched 3 of its channels. export const facetOption = ( tag: Tag, facets: Record | undefined, ): ComboboxOption => ({ value: String(tag.id), label: tag.name, count: facets ? (facets[String(tag.id)] ?? 0) : undefined, });