"use client"; import { useState } from "react"; import { Check, Clipboard, FileCode2, Terminal } from "lucide-react"; import { cn } from "@/lib/utils"; export type RankedAnalyticsItem = { label: string; count: number; }; type RankedAnalyticsListProps = { title: string; items: RankedAnalyticsItem[]; kind: "file" | "command"; }; async function copyValue(value: string, onCopied: () => void) { if (!value || typeof navigator === "undefined" || !navigator.clipboard) return; await navigator.clipboard.writeText(value); onCopied(); } export function RankedAnalyticsList({ title, items, kind, }: RankedAnalyticsListProps) { const [copied, setCopied] = useState(null); const Icon = kind === "command" ? Terminal : FileCode2; const markCopied = (value: string) => { setCopied(value); window.setTimeout(() => setCopied(null), 1400); }; return (

{title}

Top {items.length.toLocaleString()} by count

{items.length === 0 ? (
No entries in this range.
) : (
    {items.map((item, index) => (
  1. {index + 1} {item.label} {item.count.toLocaleString()}
  2. ))}
)}
); }