Feature: Kilometerstand-Feld für Fahrräder und verbesserte Warnungen

- currentMileage Feld zu Bike-Modell hinzugefügt
- calculateServiceStatus verwendet jetzt aktuellen Kilometerstand des Fahrrads
- Warnungen für überfällige Wartungen (OVERDUE Status)
- Rote Warnung bei überfälligen Teilen
- Kilometerstand wird in BikeDetail und BikeCard angezeigt
- AlertBadge unterstützt jetzt critical Variante
- Verbesserte Statusanzeige mit Überfällig-Hinweis
This commit is contained in:
Denis Urs Rudolph
2025-12-05 22:36:58 +01:00
parent 81edc206e0
commit d37676f3c0
10 changed files with 134 additions and 44 deletions

View File

@@ -40,8 +40,12 @@ export default function BikeCard({ bike, onDelete }: BikeCardProps) {
const activeParts = bike.wearParts.filter((p) => p.status === 'ACTIVE')
const needsServiceParts = activeParts.filter((part) => {
const serviceStatus = calculateServiceStatus(part)
return serviceStatus.status !== 'OK'
const serviceStatus = calculateServiceStatus(part, bike.currentMileage)
return serviceStatus.status !== 'OK' || serviceStatus.isOverdue
})
const overdueParts = activeParts.filter((part) => {
const serviceStatus = calculateServiceStatus(part, bike.currentMileage)
return serviceStatus.isOverdue
})
return (
@@ -56,7 +60,10 @@ export default function BikeCard({ bike, onDelete }: BikeCardProps) {
)}
</div>
{needsServiceParts.length > 0 && (
<AlertBadge count={needsServiceParts.length} />
<AlertBadge
count={needsServiceParts.length}
variant={overdueParts.length > 0 ? 'critical' : 'warning'}
/>
)}
</div>
@@ -64,7 +71,15 @@ export default function BikeCard({ bike, onDelete }: BikeCardProps) {
<p className="text-sm text-gray-500">
{activeParts.length} aktive Verschleißteile
</p>
{needsServiceParts.length > 0 && (
<p className="text-sm text-gray-500">
{bike.currentMileage.toLocaleString('de-DE')} km
</p>
{overdueParts.length > 0 && (
<p className="text-sm text-red-600 font-medium mt-1">
{overdueParts.length} überfällig!
</p>
)}
{needsServiceParts.length > 0 && overdueParts.length === 0 && (
<p className="text-sm text-orange-600 font-medium mt-1">
{needsServiceParts.length} benötigen Wartung
</p>