This commit is contained in:
2025-12-10 15:41:44 +01:00
parent fbbcf414a4
commit 6d61be9c51
22 changed files with 1721 additions and 1987 deletions

View File

@@ -3,6 +3,7 @@
import Card from '../ui/Card';
import RankBadge from './RankBadge';
import { getDriverStats, getAllDriverRankings, getLeagueRankings } from '@/lib/di-container';
import { getPrimaryLeagueIdForDriver } from '@/lib/leagueMembership';
interface ProfileStatsProps {
driverId?: string;
@@ -19,7 +20,9 @@ interface ProfileStatsProps {
export default function ProfileStats({ driverId, stats }: ProfileStatsProps) {
const driverStats = driverId ? getDriverStats(driverId) : null;
const allRankings = getAllDriverRankings();
const leagueRank = driverId ? getLeagueRankings(driverId, 'league-1') : null;
const primaryLeagueId = driverId ? getPrimaryLeagueIdForDriver(driverId) : null;
const leagueRank =
driverId && primaryLeagueId ? getLeagueRankings(driverId, primaryLeagueId) : null;
const defaultStats = stats || (driverStats
? {
@@ -115,7 +118,7 @@ export default function ProfileStats({ driverId, stats }: ProfileStatsProps) {
<div className="flex items-center gap-3">
<RankBadge rank={leagueRank.rank} size="md" />
<div>
<div className="text-white font-medium">European GT Championship</div>
<div className="text-white font-medium">Primary League</div>
<div className="text-sm text-gray-400">
{leagueRank.rank} of {leagueRank.totalDrivers} drivers
</div>