refactor: extract helpers from 3 match-detail/match-card components

- LocationIntelligencePanel (333→275): KpiTile + NEW_PROJECTS → own files
- FutureAvailabilityContextPanel (351→315): constants + utils → own files
- FutureAvailabilityCard (310→244): helpers + SignalQualityDots → own files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Sutter
2026-05-24 01:16:32 +02:00
parent c6055f0611
commit 01c0f8b06f
8 changed files with 158 additions and 166 deletions
@@ -0,0 +1,37 @@
export const CREDIBILITY_META: Record<string, { label: string; color: string }> = {
HIGH: { label: 'Hohe Quellenqualität', color: '#1a7a4a' },
MEDIUM: { label: 'Mittlere Quellenqualität', color: '#d97706' },
LOW: { label: 'Niedrige Quellenqualität', color: '#c0392b' },
}
export const SENSITIVITY_META: Record<string, { label: string; color: 'error' | 'warning' | 'default' }> = {
CONFIDENTIAL: { label: 'Vertraulich', color: 'error' },
INTERNAL: { label: 'Intern', color: 'warning' },
PUBLIC: { label: 'Öffentlich', color: 'default' },
}
export const RISK_META: Record<string, { label: string; color: string }> = {
LOW: { label: 'Niedrig', color: '#1a7a4a' },
MEDIUM: { label: 'Mittel', color: '#d97706' },
HIGH: { label: 'Hoch', color: '#c0392b' },
CRITICAL: { label: 'Kritisch', color: '#7f1d1d' },
}
export function ageLabel(isoDate: string): string {
const diffMs = Date.now() - new Date(isoDate).getTime()
const days = Math.floor(diffMs / 86400000)
if (days < 1) return 'Heute erkannt'
if (days < 7) return `Vor ${days} Tag${days === 1 ? '' : 'en'} erkannt`
if (days < 30) return `Vor ${Math.floor(days / 7)} Woche${Math.floor(days / 7) === 1 ? '' : 'n'} erkannt`
if (days < 365) return `Vor ${Math.floor(days / 30)} Monat${Math.floor(days / 30) === 1 ? '' : 'en'} erkannt`
return `Vor ${Math.floor(days / 365)} Jahr${Math.floor(days / 365) === 1 ? '' : 'en'} erkannt`
}
export function domainLabel(url: string): string {
try {
const u = new URL(url)
return u.hostname.replace(/^www\./, '')
} catch {
return url.length > 60 ? url.slice(0, 57) + '…' : url
}
}