refactor core presenters

This commit is contained in:
2025-12-19 19:42:19 +01:00
parent 8116fe888f
commit 94fc538f44
228 changed files with 2817 additions and 3097 deletions

View File

@@ -4,7 +4,7 @@ import Card from '../ui/Card';
import RankBadge from './RankBadge';
import { useState, useEffect } from 'react';
import { getPrimaryLeagueIdForDriver } from '@/lib/leagueMembership';
import type { ProfileOverviewViewModel } from '@core/racing/application/presenters/IProfileOverviewPresenter';
import type { ProfileOverviewOutputPort } from '@core/racing/application/ports/output/ProfileOverviewOutputPort';
interface ProfileStatsProps {
driverId?: string;
@@ -18,7 +18,7 @@ interface ProfileStatsProps {
};
}
type DriverProfileOverviewViewModel = ProfileOverviewViewModel | null;
type DriverProfileOverviewViewModel = ProfileOverviewOutputPort | null;
export default function ProfileStats({ driverId, stats }: ProfileStatsProps) {
const [profileData, setProfileData] = useState<DriverProfileOverviewViewModel>(null);
@@ -35,7 +35,7 @@ export default function ProfileStats({ driverId, stats }: ProfileStatsProps) {
}, [driverId]);
const driverStats = profileData?.stats || null;
const totalDrivers = profileData?.currentDriver?.totalDrivers ?? 0;
const totalDrivers = profileData?.driver?.totalDrivers ?? 0;
const primaryLeagueId = driverId ? getPrimaryLeagueIdForDriver(driverId) : null;
const leagueRank =
driverId && primaryLeagueId ? getLeagueRankings(driverId, primaryLeagueId) : null;