import { Dialog, DialogContent, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { Info } from "lucide-react"; interface ProofData { fieldKey: string; field: string; sourceSnippet: string; confidence: number | null; page: string | null; section: string | null; lineNumber: number | null; contextStartLine: number | null; context: string[]; resolutionMode: "exact" | "fuzzy" | "fallback"; } interface ContractProofModalProps { isOpen: boolean; onOpenChange: (open: boolean) => void; proofData: ProofData | null; } export function ContractProofModal({ isOpen, onOpenChange, proofData, }: ContractProofModalProps) { return ( Field Proof {proofData && (

Field

{proofData.field}

Line

{proofData.lineNumber ?? "Not found"}

Page

{proofData.page ?? "N/A"}

Section

{proofData.section ?? "N/A"}

Confidence

{proofData.confidence ?? "N/A"}

Exact Source Snippet

“{proofData.sourceSnippet}”

Contract Lines Context

0 && proofData.lineNumber ? "border-emerald-500/25 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300" : "border-amber-500/25 bg-amber-500/10 text-amber-700 dark:text-amber-300" }`} > {proofData.context.length > 0 && proofData.lineNumber ? "Resolved from extracted text" : "Fallback snippet evidence"}
{proofData.context.length > 0 && proofData.contextStartLine ? (
                    {proofData.context.map((line, idx) => {
                      const currentLineNumber =
                        proofData.contextStartLine! + idx;
                      const isMatch =
                        proofData.lineNumber === currentLineNumber;
                      return (
                        
                          {String(currentLineNumber).padStart(4, " ")} | {line}
                        
                      );
                    })}
                  
) : (

Precise line mapping is unavailable for this field. The quoted snippet remains the verified AI evidence.

This usually happens when OCR compressed multiple lines, formatting changed, or the source value appears in a table-like structure.

)}
)}
); }