import { useState } from "react"; import { CheckCircle, XCircle, Loader2, Shield, ShieldCheck, FileIcon, X, } from "lucide-react"; import type { Test } from "../../types/models"; // ── Props ────────────────────────────────────────────────────────── interface ValidationModalProps { side: "red" | "blue"; test: Test; isSubmitting: boolean; onSubmit: (status: "approved" | "rejected", notes: string) => void; onClose: () => void; } // ── Component ────────────────────────────────────────────────────── export default function ValidationModal({ side, test, isSubmitting, onSubmit, onClose, }: ValidationModalProps) { const [decision, setDecision] = useState<"approved" | "rejected" | null>(null); const [notes, setNotes] = useState(""); const isRed = side === "red"; const title = isRed ? "Validate as Red Lead" : "Validate as Blue Lead"; const accent = isRed ? "orange" : "indigo"; // Evidence from the corresponding team const evidences = isRed ? test.red_evidences || [] : test.blue_evidences || []; // Status of the other side's validation const otherStatus = isRed ? test.blue_validation_status : test.red_validation_status; const otherLabel = isRed ? "Blue Lead" : "Red Lead"; // Can submit? const canSubmit = decision !== null && !isSubmitting && (decision === "approved" || notes.trim().length > 0); // ── Render ─────────────────────────────────────────────────────── return (
{/* Header */}
{isRed ? ( ) : ( )}

{title}

{/* Body */}
{/* Evidence summary */}

{isRed ? "Red" : "Blue"} Team Evidence ({evidences.length})

{evidences.length > 0 ? (
{evidences.map((ev) => (
{ev.file_name}
))}
) : (

No evidence files uploaded.

)}
{/* Other side status */}
{otherLabel} status: {otherStatus === "approved" ? ( Approved ) : otherStatus === "rejected" ? ( Rejected ) : ( Pending )}
{/* Decision */}

Decision

{/* Notes */}