"use client"; import { Check, Link2 } from "lucide-react"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { CoverageBar } from "@/components/intelligence/shared"; import { fmtInt } from "@/lib/format"; /** "47 infrastructure records match · MW coverage 12 %" + Save view (copies the URL — the URL is the saved view). */ export function ResultBar({ total, entity, mwCoverage }: { total: number | null; entity: "facilities" | "projects"; mwCoverage: number | null }) { const [copied, setCopied] = useState<"ok" | "fail" | null>(null); const save = async () => { const url = window.location.href; try { await navigator.clipboard.writeText(url); setCopied("ok"); } catch { window.prompt("Copy this view's URL", url); setCopied("fail"); } setTimeout(() => setCopied(null), 2000); }; const word = entity === "projects" ? (total === 1 ? "project record" : "project records") : total === 1 ? "infrastructure record" : "infrastructure records"; return (

{total === null ? ( Results unavailable ) : ( <> {fmtInt(total)} {word} match )}

{mwCoverage !== null && ( MW coverage )}
); }