website refactor
This commit is contained in:
38
apps/website/app/teams/create/page.tsx
Normal file
38
apps/website/app/teams/create/page.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { CreateTeamForm } from '@/components/teams/CreateTeamForm';
|
||||
import { Section } from '@/ui/Section';
|
||||
import { Container } from '@/ui/Container';
|
||||
import { Heading } from '@/ui/Heading';
|
||||
import { Stack } from '@/ui/Stack';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
|
||||
export default function CreateTeamPage() {
|
||||
const router = useRouter();
|
||||
|
||||
const handleNavigate = (teamId: string) => {
|
||||
router.push(routes.team.detail(teamId));
|
||||
};
|
||||
|
||||
const handleCancel = () => {
|
||||
router.back();
|
||||
};
|
||||
|
||||
return (
|
||||
<Section>
|
||||
<Container size="sm">
|
||||
<Stack gap={8}>
|
||||
<Stack gap={2}>
|
||||
<Heading level={1}>Create a Team</Heading>
|
||||
</Stack>
|
||||
<CreateTeamForm
|
||||
onNavigate={handleNavigate}
|
||||
onCancel={handleCancel}
|
||||
/>
|
||||
</Stack>
|
||||
</Container>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -83,6 +83,7 @@ export interface RouteGroup {
|
||||
root: string;
|
||||
leaderboard: string;
|
||||
detail: (id: string) => string;
|
||||
create: string;
|
||||
};
|
||||
driver: {
|
||||
root: string;
|
||||
@@ -180,6 +181,7 @@ export const routes: RouteGroup & { leaderboards: { root: string; drivers: strin
|
||||
root: '/teams',
|
||||
leaderboard: '/teams/leaderboard',
|
||||
detail: (id: string) => `/teams/${id}`,
|
||||
create: '/teams/create',
|
||||
},
|
||||
driver: {
|
||||
root: '/drivers',
|
||||
@@ -288,7 +290,7 @@ export const routeMatchers = {
|
||||
logger.info('[RouteConfig] Path is public (driver detail)', { path });
|
||||
return true;
|
||||
}
|
||||
if (group === 'teams') {
|
||||
if (group === 'teams' && slug !== 'create') {
|
||||
logger.info('[RouteConfig] Path is public (team detail)', { path });
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user