feat: Add health grade to ChargingSession and display in BatteryScreen

This commit is contained in:
2025-12-06 23:59:13 +02:00
parent 3065abcbd7
commit 8c1a9e936d
3 changed files with 10 additions and 0 deletions

View File

@@ -198,6 +198,7 @@ interface BatteryScreenProps {
errorMessage: string | null;
latestSession: ChargingSession | null;
sohChange: number | null;
health_grade?: string | null;
}
const BatteryScreen: React.FC<BatteryScreenProps> = ({
@@ -333,6 +334,13 @@ const BatteryScreen: React.FC<BatteryScreenProps> = ({
</span>
</div>
)}
{typeof latestSession?.healthGrade === "string" && (
<div className="summary-item">
<span className="label">Health grade</span>
<span className="value">{latestSession.healthGrade}</span>
</div>
)}
</div>
</section>

View File

@@ -51,6 +51,7 @@ function mapBackendSession(raw: BackendSession): ChargingSession {
energyAddedKWh: raw.energy_added_kwh ?? undefined,
avgTempC: raw.avg_temp_c ?? undefined,
locationName: raw.location_name ?? undefined,
healthGrade: raw.health_grade ?? undefined,
};
}

View File

@@ -9,6 +9,7 @@ export interface ChargingSession {
energyAddedKWh?: number;
avgTempC?: number;
locationName?: string;
healthGrade?: string;
}
export interface SessionsResponse {