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:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user