'use client'
import {
ArrowLeft, ExternalLink, BookOpen, Scale, FileText,
Eye, CheckCircle2, Trash2, Pencil, Clock,
ChevronLeft, SkipForward,
} from 'lucide-react'
import { CanonicalControl, EFFORT_LABELS, SeverityBadge, StateBadge, LicenseRuleBadge } from './helpers'
interface ControlDetailProps {
ctrl: CanonicalControl
onBack: () => void
onEdit: () => void
onDelete: (controlId: string) => void
onReview: (controlId: string, action: string) => void
// Review mode navigation
reviewMode?: boolean
reviewIndex?: number
reviewTotal?: number
onReviewPrev?: () => void
onReviewNext?: () => void
}
export function ControlDetail({
ctrl,
onBack,
onEdit,
onDelete,
onReview,
reviewMode,
reviewIndex = 0,
reviewTotal = 0,
onReviewPrev,
onReviewNext,
}: ControlDetailProps) {
return (
{/* Header */}
{ctrl.control_id}
{ctrl.title}
{reviewMode && (
{reviewIndex + 1} / {reviewTotal}
)}
{/* Content */}
{/* Objective */}
{/* Rationale */}
Begruendung
{ctrl.rationale}
{/* Source Info (Rule 1 + 2) */}
{ctrl.source_citation && (
Quellenangabe
{Object.entries(ctrl.source_citation).map(([k, v]) => (
{k}: {v}
))}
{ctrl.source_original_text && (
Originaltext anzeigen
{ctrl.source_original_text}
)}
)}
{/* Scope */}
{(ctrl.scope.platforms?.length || ctrl.scope.components?.length || ctrl.scope.data_classes?.length) ? (
Geltungsbereich
{ctrl.scope.platforms?.length ? (
Plattformen: {ctrl.scope.platforms.join(', ')}
) : null}
{ctrl.scope.components?.length ? (
Komponenten: {ctrl.scope.components.join(', ')}
) : null}
{ctrl.scope.data_classes?.length ? (
Datenklassen: {ctrl.scope.data_classes.join(', ')}
) : null}
) : null}
{/* Requirements */}
{ctrl.requirements.length > 0 && (
Anforderungen
{ctrl.requirements.map((r, i) => (
- {r}
))}
)}
{/* Test Procedure */}
{ctrl.test_procedure.length > 0 && (
Pruefverfahren
{ctrl.test_procedure.map((s, i) => (
- {s}
))}
)}
{/* Evidence */}
{ctrl.evidence.length > 0 && (
Nachweise
{ctrl.evidence.map((ev, i) => (
{ev.type}: {ev.description}
))}
)}
{/* Meta */}
{ctrl.risk_score !== null && Risiko-Score: {ctrl.risk_score}
}
{ctrl.implementation_effort && Aufwand: {EFFORT_LABELS[ctrl.implementation_effort] || ctrl.implementation_effort}
}
{ctrl.tags.length > 0 && (
{ctrl.tags.map(t => (
{t}
))}
)}
{/* Open Anchors */}
Open-Source-Referenzen ({ctrl.open_anchors.length})
{ctrl.open_anchors.length > 0 ? (
{ctrl.open_anchors.map((anchor, i) => (
{anchor.framework}
{anchor.ref}
{anchor.url && (
Link
)}
))}
) : (
Keine Referenzen vorhanden.
)}
{/* Generation Metadata (internal) */}
{ctrl.generation_metadata && (
Generierungsdetails (intern)
Pfad: {String(ctrl.generation_metadata.processing_path || '-')}
{ctrl.generation_metadata.similarity_status && (
Similarity: {String(ctrl.generation_metadata.similarity_status)}
)}
{Array.isArray(ctrl.generation_metadata.similar_controls) && (
Aehnliche Controls:
{(ctrl.generation_metadata.similar_controls as Array
>).map((s, i) => (
{String(s.control_id)} — {String(s.title)} ({String(s.similarity)})
))}
)}
)}
{/* Review Actions */}
{['needs_review', 'too_close', 'duplicate'].includes(ctrl.release_state) && (
Review erforderlich
{reviewMode && (
Review-Modus aktiv
)}
)}
)
}