website refactor

This commit is contained in:
2026-01-14 02:02:24 +01:00
parent 8d7c709e0c
commit 4522d41aef
291 changed files with 12763 additions and 9309 deletions

View File

@@ -1,10 +1,10 @@
import { notFound } from 'next/navigation';
import { PageWrapper } from '@/components/shared/state/PageWrapper';
import { RaceDetailTemplate } from '@/templates/RaceDetailTemplate';
import { PageDataFetcher } from '@/lib/page/PageDataFetcher';
import { RACE_SERVICE_TOKEN } from '@/lib/di/tokens';
import type { RaceService } from '@/lib/services/races/RaceService';
import type { RaceDetailViewModel } from '@/lib/view-models/RaceDetailViewModel';
import { RacesApiClient } from '@/lib/api/races/RacesApiClient';
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
import { getWebsiteApiBaseUrl } from '@/lib/config/apiBaseUrl';
interface RaceDetailPageProps {
params: {
@@ -19,13 +19,20 @@ export default async function RaceDetailPage({ params }: RaceDetailPageProps) {
notFound();
}
// Fetch initial race data
const data = await PageDataFetcher.fetch<RaceService, 'getRaceDetail'>(
RACE_SERVICE_TOKEN,
'getRaceDetail',
raceId,
'' // currentDriverId - will be handled client-side for auth
);
// Manual wiring: create dependencies
const baseUrl = getWebsiteApiBaseUrl();
const logger = new ConsoleLogger();
const errorReporter = new EnhancedErrorReporter(logger, {
showUserNotifications: true,
logToConsole: true,
reportToExternal: process.env.NODE_ENV === 'production',
});
// Create API client
const apiClient = new RacesApiClient(baseUrl, errorReporter, logger);
// Fetch initial race data (empty driverId for now, handled client-side)
const data = await apiClient.getDetail(raceId, '');
if (!data) notFound();
@@ -66,7 +73,7 @@ export default async function RaceDetailPage({ params }: RaceDetailPageProps) {
isPodium: data.userResult.isPodium,
ratingChange: data.userResult.ratingChange,
} : undefined,
canReopenRace: data.canReopenRace,
canReopenRace: false, // Not provided by API, default to false
} : undefined;
return (