Files
property-match/src/components/scores/ScoreBar.tsx
T
Benjamin Sutter 70c0d79d8c feat(design-system): F003 – complete design system foundation
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>
2026-05-15 11:34:25 +02:00

50 lines
1.5 KiB
TypeScript

import { Box, LinearProgress, Typography } from '@mui/material'
import { matchScoreColor } from '../../lib/utils'
const COLOR_MAP: Record<string, string> = {
success: '#1a7a4a',
warning: '#d97706',
error: '#c0392b',
}
interface ScoreBarProps {
label: string
value: number
weight?: number
color?: string
maxWidth?: number
}
export function ScoreBar({ label, value, weight, color, maxWidth = 200 }: ScoreBarProps) {
const resolved = color ?? COLOR_MAP[matchScoreColor(value)] ?? '#1e3a5f'
return (
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 0.25 }}>
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', maxWidth }}>
<Typography sx={{ fontSize: '0.75rem', color: 'text.secondary', lineHeight: 1.4 }}>
{label}
</Typography>
<Typography sx={{ fontSize: '0.75rem', fontWeight: 700, color: resolved, fontVariantNumeric: 'tabular-nums', ml: 1 }}>
{value}
</Typography>
</Box>
<LinearProgress
variant="determinate"
value={Math.min(value, 100)}
sx={{
height: 5,
borderRadius: 2,
maxWidth,
bgcolor: 'rgba(0,0,0,0.06)',
'& .MuiLinearProgress-bar': { bgcolor: resolved, borderRadius: 2 },
}}
/>
{weight !== undefined && (
<Typography sx={{ fontSize: '0.68rem', color: 'text.disabled', lineHeight: 1 }}>
Gewicht: {Math.round(weight * 100)}%
</Typography>
)}
</Box>
)
}