import { useState } from "react"; import { ChevronDown, ChevronUp, Loader2, Lock } from "lucide-react"; import type { DataClassification } from "../../types/models"; // ── Options ──────────────────────────────────────────────────────── const CLASSIFICATION_OPTIONS: { value: DataClassification; label: string; color: string }[] = [ { value: "public_release", label: "Public Release", color: "border-gray-500/30 bg-gray-800/50 text-gray-400" }, { value: "general_use", label: "General Use", color: "border-blue-500/30 bg-blue-900/30 text-blue-400" }, { value: "confidential", label: "Confidential", color: "border-amber-500/30 bg-amber-900/30 text-amber-400" }, { value: "restricted", label: "Restricted", color: "border-red-500/30 bg-red-900/30 text-red-400" }, ]; // ── Props ────────────────────────────────────────────────────────── interface DataClassificationBadgeProps { value: DataClassification; canEdit: boolean; isSaving: boolean; onChange: (value: DataClassification) => void; } // ── Component ────────────────────────────────────────────────────── export default function DataClassificationBadge({ value, canEdit, isSaving, onChange, }: DataClassificationBadgeProps) { const [expanded, setExpanded] = useState(false); const current = CLASSIFICATION_OPTIONS.find((o) => o.value === value) ?? CLASSIFICATION_OPTIONS[1]; if (!canEdit) { return ( {current.label} ); } return (
{expanded && (
{isSaving ? (
) : ( CLASSIFICATION_OPTIONS.map((opt) => ( )) )}
)}
); }