"use client"; import { VIDEO_STATE_LABELS, type VideoState } from "yt-dlp-transcript-common/lib/availability"; import { cn } from "@/lib/utils"; import type { Facets as FacetCounts } from "@/lib/research/types"; // --------------------------------------------------------------------------- // The facets column (canvas `.facets`): the year histogram, channels, the // text (our transcription or the platform's captions), the state on the // platform, and the reading log's three piles. Every count is MEASUREMENT, so // it is Meter; a facet is a button that narrows the list on this page -- the // search is not run again, and the header says "showing N of M". // --------------------------------------------------------------------------- export type FacetPick = { year?: string; channel?: string; track?: string; state?: string; reading?: "read" | "skipped" | "unread" }; const TRACK_WORD: Record = { transcript: "transcription", captions: "captions", unknown: "not known", post: "posts" }; function Row({ label, n, of, on, onClick }: { label: string; n: number; of?: number; on: boolean; onClick: () => void }) { return ( ); } export default function Facets({ facets, reading, pick, onPick, }: { facets: FacetCounts; reading: { read: number; skipped: number; unread: number }; pick: FacetPick; onPick: (p: FacetPick) => void; }) { const peak = Math.max(1, ...facets.years.map((y) => y.n)); const chMax = Math.max(1, ...facets.channels.map((c) => c.n)); const set = (k: K, v: FacetPick[K]) => onPick({ ...pick, [k]: pick[k] === v ? undefined : v }); const tracks = Object.entries(facets.tracks).sort((a, b) => b[1] - a[1]); const states = Object.entries(facets.states).sort((a, b) => b[1] - a[1]); return ( ); }