import { memo } from 'react'; import { RelatedFindingRing, useRelatedFindings } from '../../features/related-findings/RelatedFindings'; import type { FindingRecord } from '../../domain/finding'; import { normalizeSeverity } from '../../profiles/purple-knight/presentation'; import { toolIdForRecord } from '../../importers/status-normalization'; import { findingOutcomeMark, resultStatusFieldFor } from '../../features/linked-results/result-message'; import { policyDiagnosticBadges } from '../../profiles/group-policy/categories'; import { highlightText } from '../HighlightText/highlight-text'; export function findingCardStatus(record: FindingRecord, fallbackToolId?: string) { return resultStatusFieldFor(record, fallbackToolId); } interface Props { record: FindingRecord; title: string; bookmarked: boolean; selected?: boolean; /** Werkzeug-ID des Datasets; entscheidet ueber die werkzeuggebundene Statusnormalisierung. */ toolId?: string; search?: string; onOpen(): void; } function FindingCardComponent({ record, title, bookmarked, selected, toolId, search, onOpen }: Props) { const groupMarked = useRelatedFindings()?.selection?.group.recordIds.includes(record.id); const severityField = record.fields.find(field => /^(severity|criticality|priority)$/i.test(field.label) && field.value); const severity = normalizeSeverity(severityField?.value); const outcomeMark = findingOutcomeMark(record, toolId); const resolvedToolId = toolIdForRecord(record, toolId); const diagnostics = policyDiagnosticBadges(record, resolvedToolId); return (