refactor: GenericBadge + Provider-Isolation
Teil A — GenericBadge:
- Neue src/components/shared/GenericBadge.tsx mit zwei Varianten:
transparent (${color}18 Hintergrund, farbiger Text, opt. Border)
solid (gefüllte Farbe, weisser Text)
- Props: label, color, variant, showBorder, bold, icon, size, tooltip, ariaLabel
- 7 Badges auf GenericBadge refactored (Config-Objekt + 1-Zeiler):
ReviewStatusBadge, ReviewPriorityBadge, ReviewEntityTypeBadge,
AIOutputStatusBadge, AIErrorBadge, MatchStatusBadge, ShortlistStatusBadge
- Barrel-Export in src/components/shared/index.ts
Teil B — Provider-Isolation:
- src/mock-data/propertyStore.ts als neutrales Daten-Modul erstellt
- MockupPropertyProvider: importiert aus mock-data statt selbst zu definieren
- MockupUnitProvider: importiert aus mock-data statt aus MockupPropertyProvider
- matchSyncService: importiert aus mock-data statt aus MockupPropertyProvider
- Kein Provider importiert mehr einen anderen Provider
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,33 +1,21 @@
|
||||
import { Chip } from '@mui/material'
|
||||
import { GenericBadge } from '../shared/GenericBadge'
|
||||
import type { ReviewTaskStatus } from '../../domain/review'
|
||||
|
||||
interface ReviewStatusBadgeProps {
|
||||
const CONFIG: Record<ReviewTaskStatus, { label: string; color: string }> = {
|
||||
PENDING: { label: 'Ausstehend', color: '#d97706' },
|
||||
IN_REVIEW: { label: 'In Prüfung', color: '#2563eb' },
|
||||
APPROVED: { label: 'Genehmigt', color: '#1a7a4a' },
|
||||
REJECTED: { label: 'Abgelehnt', color: '#c0392b' },
|
||||
NEEDS_MORE_DATA: { label: 'Mehr Daten nötig', color: '#7c3aed' },
|
||||
ESCALATED: { label: 'Eskaliert', color: '#ea580c' },
|
||||
}
|
||||
|
||||
interface Props {
|
||||
status: ReviewTaskStatus
|
||||
size?: 'small' | 'medium'
|
||||
}
|
||||
|
||||
const CONFIG: Record<ReviewTaskStatus, { label: string; color: string }> = {
|
||||
PENDING: { label: 'Ausstehend', color: '#d97706' },
|
||||
IN_REVIEW: { label: 'In Prüfung', color: '#2563eb' },
|
||||
APPROVED: { label: 'Genehmigt', color: '#1a7a4a' },
|
||||
REJECTED: { label: 'Abgelehnt', color: '#c0392b' },
|
||||
NEEDS_MORE_DATA: { label: 'Mehr Daten nötig', color: '#7c3aed' },
|
||||
ESCALATED: { label: 'Eskaliert', color: '#ea580c' },
|
||||
}
|
||||
|
||||
export function ReviewStatusBadge({ status, size = 'small' }: ReviewStatusBadgeProps) {
|
||||
export function ReviewStatusBadge({ status, size = 'small' }: Props) {
|
||||
const { label, color } = CONFIG[status] ?? CONFIG.PENDING
|
||||
return (
|
||||
<Chip
|
||||
size={size}
|
||||
label={label}
|
||||
sx={{
|
||||
bgcolor: `${color}18`,
|
||||
color,
|
||||
fontWeight: 600,
|
||||
fontSize: size === 'small' ? '0.7rem' : '0.8125rem',
|
||||
border: `1px solid ${color}40`,
|
||||
}}
|
||||
/>
|
||||
)
|
||||
return <GenericBadge label={label} color={color} showBorder size={size} />
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user