"use client"; type Violation = { id: string; source: string; description: string; severity: string; status: string; detected_at: string; owner?: string; }; const SEVERITY_STYLES: Record = { critical: { bg: "bg-red-500/20", text: "text-red-500", labelAr: "حرج" }, high: { bg: "bg-orange-500/20", text: "text-orange-500", labelAr: "عالي" }, medium: { bg: "bg-yellow-500/20", text: "text-yellow-500", labelAr: "متوسط" }, low: { bg: "bg-gray-500/20", text: "text-gray-400", labelAr: "منخفض" }, }; const STATUS_LABELS: Record = { detected: "تم الاكتشاف", reviewing: "قيد المراجعة", resolved: "تم الحل", accepted: "مقبول", }; export function PolicyViolationsBoard({ violations = [] }: { violations?: Violation[] }) { const active = violations.filter((v) => v.status === "detected" || v.status === "reviewing"); const resolved = violations.filter((v) => v.status === "resolved" || v.status === "accepted"); return (

لوحة مخالفات السياسات | Policy Violations Board

{/* Summary */}
الإجمالي
{violations.length}
نشطة
{active.length}
حرجة
{violations.filter((v) => v.severity === "critical" && (v.status === "detected" || v.status === "reviewing")).length}
محلولة
{resolved.length}
{/* Active Violations */} {active.length > 0 && (

المخالفات النشطة

{active.map((v) => { const style = SEVERITY_STYLES[v.severity] || SEVERITY_STYLES.medium; return (
{STATUS_LABELS[v.status] || v.status}
{style.labelAr} {v.source}

{v.description}

); })}
)} {violations.length === 0 && (

لا توجد مخالفات مسجلة

)}
); }