website refactor
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
import { DashboardPageQuery } from '@/lib/page-queries/DashboardPageQuery';
|
||||
import { DashboardTemplate } from '@/templates/DashboardTemplate';
|
||||
import { DashboardPageClient } from '@/client-wrapper/DashboardPageClient';
|
||||
import { logger } from '@/lib/infrastructure/logging/logger';
|
||||
|
||||
export default async function DashboardPage() {
|
||||
@@ -23,5 +23,5 @@ export default async function DashboardPage() {
|
||||
|
||||
// Success
|
||||
const viewData = result.unwrap();
|
||||
return <DashboardTemplate viewData={viewData} />;
|
||||
}
|
||||
return <DashboardPageClient viewData={viewData} />;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import { CreateLeagueWizard } from '@/client-wrapper/CreateLeagueWizard';
|
||||
import { Section } from '@/ui/Section';
|
||||
import { Container } from '@/ui/Container';
|
||||
@@ -10,11 +6,13 @@ import { SearchParamBuilder } from '@/lib/routing/search-params/SearchParamBuild
|
||||
|
||||
type StepName = 'basics' | 'visibility' | 'structure' | 'schedule' | 'scoring' | 'stewarding' | 'review';
|
||||
|
||||
export default function CreateLeaguePage() {
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
interface CreateLeaguePageProps {
|
||||
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
|
||||
}
|
||||
|
||||
const wizardParams = SearchParamParser.parseWizard(searchParams as unknown as URLSearchParams).unwrap();
|
||||
export default async function CreateLeaguePage({ searchParams }: CreateLeaguePageProps) {
|
||||
const resolvedParams = await searchParams;
|
||||
const wizardParams = SearchParamParser.parseWizard(resolvedParams as any).unwrap();
|
||||
const rawStep = wizardParams.step;
|
||||
|
||||
let currentStepName: StepName = 'basics';
|
||||
@@ -28,23 +26,11 @@ export default function CreateLeaguePage() {
|
||||
currentStepName = rawStep;
|
||||
}
|
||||
|
||||
const handleStepChange = (stepName: StepName) => {
|
||||
const builder = new SearchParamBuilder();
|
||||
// Copy existing params if needed, but here we just want to set the step
|
||||
if (searchParams) {
|
||||
searchParams.forEach((value, key) => {
|
||||
if (key !== 'step') builder.set(key, value);
|
||||
});
|
||||
}
|
||||
builder.step(stepName);
|
||||
router.push(`/leagues/create${builder.build()}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<Section>
|
||||
<Container size="md">
|
||||
<CreateLeagueWizard stepName={currentStepName} onStepChange={handleStepChange} />
|
||||
<CreateLeagueWizard stepName={currentStepName} />
|
||||
</Container>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { PageWrapper } from '@/components/shared/state/PageWrapper';
|
||||
import { HomeTemplate, type HomeViewData } from '@/templates/HomeTemplate';
|
||||
import { HomePageClient } from '@/client-wrapper/HomePageClient';
|
||||
import { PageDataFetcher } from '@/lib/page/PageDataFetcher';
|
||||
import { HomePageQuery } from '@/lib/page-queries/HomePageQuery';
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
@@ -19,7 +18,5 @@ export default async function Page() {
|
||||
notFound();
|
||||
}
|
||||
|
||||
const Template = ({ viewData }: { viewData: HomeViewData }) => <HomeTemplate viewData={viewData} />;
|
||||
|
||||
return <PageWrapper data={data} Template={Template} />;
|
||||
return <HomePageClient viewData={data} />;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { useState } from 'react';
|
||||
import { SponsorSettingsTemplate } from '@/templates/SponsorSettingsTemplate';
|
||||
import { logoutAction } from '@/app/actions/logoutAction';
|
||||
import { ConfirmDialog } from '@/ui/ConfirmDialog';
|
||||
import { ConfirmDialog } from '@/components/shared/ConfirmDialog';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
import { logger } from '@/lib/infrastructure/logging/logger';
|
||||
|
||||
@@ -1,37 +1,5 @@
|
||||
'use client';
|
||||
import { CreateTeamPageClient } from '@/client-wrapper/CreateTeamPageClient';
|
||||
|
||||
import { CreateTeamForm } from '@/components/teams/CreateTeamForm';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
import { Container } from '@/ui/Container';
|
||||
import { Heading } from '@/ui/Heading';
|
||||
import { Stack } from '@/ui/Stack';
|
||||
import { Section } from '@/ui/Section';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
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>
|
||||
);
|
||||
export default async function CreateTeamPage() {
|
||||
return <CreateTeamPageClient />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user