feat: Add health grade to ChargingSession and display in BatteryScreen
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ export interface ChargingSession {
|
||||
energyAddedKWh?: number;
|
||||
avgTempC?: number;
|
||||
locationName?: string;
|
||||
healthGrade?: string;
|
||||
}
|
||||
|
||||
export interface SessionsResponse {
|
||||
|
||||
Reference in New Issue
Block a user