import { CircleAlertIcon, CircleCheckIcon } from "lucide-react"; import type { JobResult } from "@/lib/db/schema"; import { formatBytes } from "@/lib/format"; import { cn } from "@/lib/utils"; function PathList({ title, paths, tone }: { title: string; paths: string[]; tone: "bad" | "muted" }) { if (paths.length === 0) return null; return (
{title} ({paths.length})
); } /** Outcome of a (deep) verify: problems per kind, plus extra files in the folder. */ export function VerifyResult({ result, deep }: { result: JobResult; deep: boolean }) { const missing = result.missing ?? []; const sizeMismatch = result.sizeMismatch ?? []; const hashMismatch = result.hashMismatch ?? []; const extra = result.extra ?? []; const problems = missing.length + sizeMismatch.length + hashMismatch.length; const extraBytes = extra.reduce((s, e) => s + e.size, 0); return (

0 ? "text-destructive" : "text-emerald-700 dark:text-emerald-400")}> {problems > 0 ? : } {problems > 0 ? `${problems} of ${result.checked ?? 0} files need repair` : `All ${result.checked ?? 0} files OK${deep ? ", hashes match the Hub" : ""}`}

{extra.length > 0 && ( (e.inRepo ? `${e.path} (repo file, not selected)` : e.path))} tone="muted" /> )}
); }