website refactor
This commit is contained in:
@@ -1,6 +1,32 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { TeamDetailPageQuery } from '@/lib/page-queries/TeamDetailPageQuery';
|
||||
import { TeamDetailPageClient } from '@/client-wrapper/TeamDetailPageClient';
|
||||
import { Metadata } from 'next';
|
||||
import { MetadataHelper } from '@/lib/seo/MetadataHelper';
|
||||
import { JsonLd } from '@/ui/JsonLd';
|
||||
|
||||
export async function generateMetadata({ params }: { params: Promise<{ id: string }> }): Promise<Metadata> {
|
||||
const { id } = await params;
|
||||
const result = await TeamDetailPageQuery.execute(id);
|
||||
|
||||
if (result.isErr()) {
|
||||
return MetadataHelper.generate({
|
||||
title: 'Team Not Found',
|
||||
description: 'The requested team could not be found on GridPilot.',
|
||||
path: `/teams/${id}`,
|
||||
});
|
||||
}
|
||||
|
||||
const viewData = result.unwrap();
|
||||
const team = viewData.team;
|
||||
|
||||
return MetadataHelper.generate({
|
||||
title: team.name,
|
||||
description: team.description || `Explore ${team.name} on GridPilot. View team roster, race history, and performance statistics in professional iRacing leagues.`,
|
||||
path: `/teams/${id}`,
|
||||
// image: team.logoUrl, // If logoUrl exists in viewData
|
||||
});
|
||||
}
|
||||
|
||||
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
@@ -15,5 +41,30 @@ export default async function Page({ params }: { params: Promise<{ id: string }>
|
||||
notFound();
|
||||
}
|
||||
|
||||
return <TeamDetailPageClient viewData={result.unwrap()} />;
|
||||
const viewData = result.unwrap();
|
||||
const team = viewData.team;
|
||||
|
||||
const jsonLd = {
|
||||
'@context': 'https://schema.org',
|
||||
'@type': 'SportsTeam',
|
||||
name: team.name,
|
||||
description: team.description,
|
||||
url: `https://gridpilot.com/teams/${team.id}`,
|
||||
member: viewData.memberships.map(m => ({
|
||||
'@type': 'OrganizationRole',
|
||||
member: {
|
||||
'@type': 'Person',
|
||||
name: m.driverName,
|
||||
url: `https://gridpilot.com/drivers/${m.driverId}`,
|
||||
},
|
||||
roleName: m.role,
|
||||
})),
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<JsonLd data={jsonLd} />
|
||||
<TeamDetailPageClient viewData={viewData} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { TeamLeaderboardPageQuery } from '@/lib/page-queries/TeamLeaderboardPageQuery';
|
||||
import { TeamLeaderboardPageWrapper } from '@/client-wrapper/TeamLeaderboardPageWrapper';
|
||||
import { Metadata } from 'next';
|
||||
import { MetadataHelper } from '@/lib/seo/MetadataHelper';
|
||||
|
||||
export const metadata: Metadata = MetadataHelper.generate({
|
||||
title: 'Team Leaderboard',
|
||||
description: 'The definitive ranking of sim racing teams on GridPilot. Compare team performance, championship points, and overall standing in the professional iRacing community.',
|
||||
path: '/teams/leaderboard',
|
||||
});
|
||||
|
||||
export default async function TeamLeaderboardPage() {
|
||||
const query = new TeamLeaderboardPageQuery();
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { TeamsPageQuery } from '@/lib/page-queries/TeamsPageQuery';
|
||||
import { TeamsPageClient } from '@/client-wrapper/TeamsPageClient';
|
||||
import { Metadata } from 'next';
|
||||
import { MetadataHelper } from '@/lib/seo/MetadataHelper';
|
||||
|
||||
export const metadata: Metadata = MetadataHelper.generate({
|
||||
title: 'Sim Racing Teams',
|
||||
description: 'Discover the most competitive sim racing teams on GridPilot. Track team performance, rosters, and achievements across the professional iRacing landscape.',
|
||||
path: '/teams',
|
||||
});
|
||||
|
||||
export default async function Page() {
|
||||
const query = new TeamsPageQuery();
|
||||
|
||||
Reference in New Issue
Block a user