website cleanup

This commit is contained in:
2025-12-24 21:44:58 +01:00
parent 9b683a59d3
commit d78854a4c6
277 changed files with 6141 additions and 2693 deletions

View File

@@ -104,7 +104,7 @@ export default function UserPill() {
const dto = await driverService.findById(primaryDriverId);
if (!cancelled) {
setDriver(dto);
setDriver(dto ? (dto as unknown as DriverDTO) : null);
}
}
@@ -120,36 +120,10 @@ export default function UserPill() {
return null;
}
const driverStats = getDriverStats(primaryDriverId);
const allRankings = getAllDriverRankings();
let rating: number | null = driverStats?.rating ?? null;
let rank: number | null = null;
let totalDrivers: number | null = null;
if (driverStats) {
totalDrivers = allRankings.length || null;
if (typeof driverStats.overallRank === 'number' && driverStats.overallRank > 0) {
rank = driverStats.overallRank;
} else {
const indexInGlobal = allRankings.findIndex(
(stat) => stat.driverId === driverStats.driverId,
);
if (indexInGlobal !== -1) {
rank = indexInGlobal + 1;
}
}
if (rating === null) {
const globalEntry = allRankings.find(
(stat) => stat.driverId === driverStats.driverId,
);
if (globalEntry) {
rating = globalEntry.rating;
}
}
}
// Driver rating + rank are not exposed by the current API contract for the lightweight
// driver DTO used in the header. Keep it null until the API provides it.
const rating: number | null = null;
const rank: number | null = null;
const avatarSrc = mediaService.getDriverAvatar(primaryDriverId);
@@ -369,4 +343,4 @@ export default function UserPill() {
</AnimatePresence>
</div>
);
}
}