import { Copy, FileText, X } from "lucide-react"; import { useEffect, useState } from "react"; import type { HCCCandidate } from "../lib/types"; import { cn } from "../lib/cn"; interface Props { candidate: HCCCandidate | null; onClose: () => void; } /** * Full-screen modal rendering the pre-drafted clinician chart-query. The coder * clicks Copy, pastes into their EHR provider-query tool, and edits as needed. */ export function QueryModal({ candidate, onClose }: Props) { const [copied, setCopied] = useState(false); useEffect(() => { function onKey(e: KeyboardEvent) { if (e.key === "Escape") onClose(); } window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, [onClose]); useEffect(() => { if (copied) { const t = setTimeout(() => setCopied(false), 1500); return () => clearTimeout(t); } }, [copied]); if (!candidate || !candidate.query_draft) return null; async function onCopy() { if (!candidate?.query_draft) return; await navigator.clipboard.writeText(candidate.query_draft); setCopied(true); } return (
e.stopPropagation()} >

Chart query — {candidate.hcc}

Draft to send to the attending. Edit before sending.

            {candidate.query_draft}
          
); }