website refactor

This commit is contained in:
2026-01-20 21:35:50 +01:00
parent 06207bf835
commit 51288234f4
42 changed files with 892 additions and 449 deletions

View File

@@ -3,11 +3,36 @@ import { LeagueOverviewTemplate } from '@/templates/LeagueOverviewTemplate';
import { LeagueDetailPageQuery } from '@/lib/page-queries/LeagueDetailPageQuery';
import { LeagueDetailViewDataBuilder } from '@/lib/builders/view-data/LeagueDetailViewDataBuilder';
import { ErrorBanner } from '@/ui/ErrorBanner';
import { Metadata } from 'next';
import { MetadataHelper } from '@/lib/seo/MetadataHelper';
import { JsonLd } from '@/ui/JsonLd';
interface Props {
params: Promise<{ id: string }>;
}
export async function generateMetadata({ params }: Props): Promise<Metadata> {
const { id } = await params;
const result = await LeagueDetailPageQuery.execute(id);
if (result.isErr()) {
return MetadataHelper.generate({
title: 'League Not Found',
description: 'The requested league could not be found on GridPilot.',
path: `/leagues/${id}`,
});
}
const data = result.unwrap();
const league = data.league;
return MetadataHelper.generate({
title: league.name,
description: league.description || `Join ${league.name} on GridPilot. Professional iRacing league with automated results, standings, and obsessive attention to detail.`,
path: `/leagues/${id}`,
});
}
export default async function Page({ params }: Props) {
const { id } = await params;
// Execute the PageQuery
@@ -36,6 +61,7 @@ export default async function Page({ params }: Props) {
}
const data = result.unwrap();
const league = data.league;
// Build ViewData using the builder
// Note: This would need additional data (owner, scoring config, etc.) in real implementation
@@ -47,8 +73,19 @@ export default async function Page({ params }: Props) {
races: [],
sponsors: [],
});
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'SportsOrganization',
name: league.name,
description: league.description,
url: `https://gridpilot.com/leagues/${league.id}`,
};
return (
<LeagueOverviewTemplate viewData={viewData} />
<>
<JsonLd data={jsonLd} />
<LeagueOverviewTemplate viewData={viewData} />
</>
);
}

View File

@@ -1,6 +1,14 @@
import { notFound } from 'next/navigation';
import { LeaguesPageClient } from './LeaguesPageClient';
import { LeaguesPageQuery } from '@/lib/page-queries/LeaguesPageQuery';
import { Metadata } from 'next';
import { MetadataHelper } from '@/lib/seo/MetadataHelper';
export const metadata: Metadata = MetadataHelper.generate({
title: 'iRacing Leagues',
description: 'Find and join the most professional iRacing leagues on GridPilot. Automated results, professional race control, and obsessive attention to detail for every series.',
path: '/leagues',
});
export default async function Page() {
// Execute the PageQuery