/** * @file configPrimitives.tsx * @description Small tool-agnostic atoms shared by the config-explorer UI * (Claude Code today, Codex next): an empty-state card, a skeleton-row list * placeholder, a copy-to-clipboard button, and a byte-size formatter. None * of these know about any particular tool's API. * @author Nguyễn Ngọc Trí Vĩ */ import { useState } from "react"; import { useTranslation } from "react-i18next"; import { Copy, Check } from "lucide-react"; export function CopyButton({ value }: { value: string }) { const { t } = useTranslation("ccConfig"); const [copied, setCopied] = useState(false); return ( ); } export function Empty() { const { t } = useTranslation("ccConfig"); return (
{t("common.empty")}
); } export function SkeletonRows({ n }: { n: number }) { return (
{Array.from({ length: n }).map((_, i) => (
))}
); } export function formatBytes(bytes: number): string { if (bytes < 1024) return `${bytes} B`; if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`; return `${(bytes / 1024 / 1024).toFixed(1)} MB`; }