Files
gridpilot.gg/apps/website/app/leagues/[id]/settings/page.tsx
Marc Mintel 1b0a1f4aee
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 7m11s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-24 23:29:55 +01:00

74 lines
1.9 KiB
TypeScript

import { LeagueSettingsPageQuery } from '@/lib/page-queries/LeagueSettingsPageQuery';
import { LeagueSettingsTemplate } from '@/templates/LeagueSettingsTemplate';
import { notFound } from 'next/navigation';
interface Props {
params: Promise<{ id: string }>;
}
export default async function LeagueSettingsPage({ params }: Props) {
const { id: leagueId } = await params;
if (!leagueId) {
notFound();
}
const result = await LeagueSettingsPageQuery.execute(leagueId);
if (result.isErr()) {
const error = result.getError();
if (error === 'notFound') {
notFound();
}
// For serverError, show the template with empty data
return <LeagueSettingsTemplate viewData={{
league: {
id: leagueId,
name: 'Unknown League',
ownerId: 'unknown',
createdAt: '1970-01-01T00:00:00Z',
},
config: {
basics: {
name: 'Unknown League',
description: 'League information unavailable',
visibility: 'private',
gameId: 'unknown',
},
structure: {
mode: 'solo',
maxDrivers: 0,
},
championships: {
enableDriverChampionship: true,
enableTeamChampionship: false,
enableNationsChampionship: false,
enableTrophyChampionship: false,
},
scoring: {
patternId: 'unknown',
},
dropPolicy: {
strategy: 'none',
},
timings: {},
stewarding: {
decisionMode: 'single_steward',
requireDefense: false,
defenseTimeLimit: 24,
voteTimeLimit: 24,
protestDeadlineHours: 24,
stewardingClosesHours: 48,
notifyAccusedOnProtest: true,
notifyOnVoteRequired: true,
},
},
presets: [],
owner: null,
members: [],
}} />;
}
return <LeagueSettingsTemplate viewData={result.unwrap()} />;
}