import { EmptyState } from "./EmptyState"; import type { Topic } from "../lib/types"; import { normalize } from "../lib/normalize"; import { faNum } from "../lib/formatters"; import { cn } from "../lib/utils"; export interface TopicGridProps { topics: Topic[]; selectedTopic?: string; onSelect: (topicName: string) => void; showCounts?: boolean; counts?: Record; } export function TopicGrid({ topics, selectedTopic, onSelect, showCounts = false, counts }: TopicGridProps) { if (!topics.length) { return ; } return (
{topics.map((t) => { const selected = selectedTopic != null && normalize(selectedTopic) === normalize(t.name); const count = counts?.[t.name] ?? 0; return ( ); })}
); }