70c0d79d8c
Design tokens: - lib/ds.ts: DS_COLORS (resultType/confidence/risk/availability/freshness/dataQuality), scoreToConfidenceLevel(), scoreToDataQualityLevel() - lib/constants.ts: added CONFIDENCE_LABELS, DATA_QUALITY_LABELS Badge system (src/components/badges/): - ResultTypeBadge, ConfidenceBadge, RiskBadge, AvailabilityBadge, FreshnessBadge, DataQualityBadge - All use DS_COLORS, MUI Chip size=small, lucide icons, German labels from constants Score components (src/components/scores/): - ConfidenceScore: numeric % with color from utils.confidenceHex - DataQualityScore: LinearProgress + qualitative label - ScoreBar: horizontal bar with label/value/weight - ScoreBreakdownMini: ScoreFactor[] mapped to ScoreBars with Tooltip explanations Card system (src/components/cards/): - DecisionCard: header+badges+score+body+actions, selected/loading/restricted states - CompactCard: single-row 48px card with leading/trailing slots - MetricCard: KPI card with label/value/delta/icon (extracted pattern from SupplyDashboard) Panel system (src/components/panels/): - InfoPanel: outlined Paper with icon+title header - DetailPanel: Accordion sections in bordered Paper - WarningPanel: MUI Alert with warning/critical severity Table components (src/components/tables/): - DataTableShell: Paper+TableContainer+Table with loading/empty/toolbar slots - TableToolbar: flex row with title/count/filters/actions - FilterBar: deletable Chips with clear-all - EmptyTableState: centered empty row spanning all cols - LoadingRows: Skeleton cell rows Form components (src/components/forms/): - TextInput: MUI TextField wrapper with onChange(string) signature - SelectField: generic SelectField<T extends string> with MUI Select - PriorityChipGroup: togglable Chip set (single/multi select) - FieldWithConfidence: label+value+ConfidenceBadge for AI-parsed fields UI additions (src/components/ui/): - CardSkeleton, PanelLoadingState, UnauthorizedState, RestrictedState Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
32 lines
878 B
TypeScript
32 lines
878 B
TypeScript
import { Chip } from '@mui/material'
|
|
import { AlertTriangle, Shield } from 'lucide-react'
|
|
import type { RiskLevel } from '../../domain/enums'
|
|
import { DS_COLORS } from '../../lib/ds'
|
|
import { RISK_LABELS } from '../../lib/constants'
|
|
|
|
interface RiskBadgeProps {
|
|
level: RiskLevel
|
|
size?: 'small' | 'medium'
|
|
}
|
|
|
|
export function RiskBadge({ level, size = 'small' }: RiskBadgeProps) {
|
|
const { bg, fg } = DS_COLORS.risk[level]
|
|
const Icon = level === 'LOW' || level === 'MEDIUM' ? Shield : AlertTriangle
|
|
return (
|
|
<Chip
|
|
size={size}
|
|
label={RISK_LABELS[level] ?? level}
|
|
icon={<Icon size={11} color={fg} />}
|
|
aria-label={`Risiko: ${RISK_LABELS[level] ?? level}`}
|
|
sx={{
|
|
bgcolor: bg,
|
|
color: fg,
|
|
border: 'none',
|
|
fontWeight: 600,
|
|
fontSize: '0.7rem',
|
|
'& .MuiChip-icon': { ml: 0.5 },
|
|
}}
|
|
/>
|
|
)
|
|
}
|