website refactor
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { NotFoundPageClient } from './NotFoundPageClient';
|
||||
import { NotFoundPageClient } from '@/client-wrapper/NotFoundPageClient';
|
||||
|
||||
/**
|
||||
* Custom404Page
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { describe, it, expect, vi } from 'vitest';
|
||||
import { ServerErrorPageClient } from './ServerErrorPageClient';
|
||||
import { useRouter } from 'next/navigation';
|
||||
|
||||
vi.mock('next/navigation', () => ({
|
||||
useRouter: vi.fn(),
|
||||
}));
|
||||
|
||||
describe('ServerErrorPageClient', () => {
|
||||
it('renders the server error page with correct content', () => {
|
||||
const push = vi.fn();
|
||||
(useRouter as any).mockReturnValue({ push });
|
||||
|
||||
render(<ServerErrorPageClient />);
|
||||
|
||||
expect(screen.getByText('CRITICAL_SYSTEM_FAILURE')).toBeDefined();
|
||||
expect(screen.getByText(/The application engine encountered an unrecoverable state/)).toBeDefined();
|
||||
expect(screen.getByText(/Internal Server Error/)).toBeDefined();
|
||||
});
|
||||
|
||||
it('handles home navigation', () => {
|
||||
const push = vi.fn();
|
||||
(useRouter as any).mockReturnValue({ push });
|
||||
|
||||
render(<ServerErrorPageClient />);
|
||||
|
||||
const homeButton = screen.getByText('Return to Pits');
|
||||
fireEvent.click(homeButton);
|
||||
|
||||
expect(push).toHaveBeenCalledWith('/');
|
||||
});
|
||||
|
||||
it('handles retry via page reload', () => {
|
||||
const push = vi.fn();
|
||||
(useRouter as any).mockReturnValue({ push });
|
||||
|
||||
const reloadFn = vi.fn();
|
||||
vi.stubGlobal('location', { reload: reloadFn });
|
||||
|
||||
render(<ServerErrorPageClient />);
|
||||
|
||||
const retryButton = screen.getByText('Retry Session');
|
||||
fireEvent.click(retryButton);
|
||||
|
||||
expect(reloadFn).toHaveBeenCalled();
|
||||
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
});
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ServerErrorPageClient } from './ServerErrorPageClient';
|
||||
import { ServerErrorPageClient } from '@/client-wrapper/ServerErrorPageClient';
|
||||
|
||||
/**
|
||||
* Custom500Page
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AdminDashboardPageQuery } from '@/lib/page-queries/AdminDashboardPageQuery';
|
||||
import { AdminDashboardWrapper } from './AdminDashboardWrapper';
|
||||
import { AdminDashboardWrapper } from '@/client-wrapper/AdminDashboardWrapper';
|
||||
import { ErrorBanner } from '@/ui/ErrorBanner';
|
||||
|
||||
export default async function AdminPage() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AdminUsersPageQuery } from '@/lib/page-queries/AdminUsersPageQuery';
|
||||
import { AdminUsersWrapper } from './AdminUsersWrapper';
|
||||
import { AdminUsersWrapper } from '@/client-wrapper/AdminUsersWrapper';
|
||||
import { ErrorBanner } from '@/ui/ErrorBanner';
|
||||
|
||||
export default async function AdminUsersPage() {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { AuthError } from '@/components/auth/AuthError';
|
||||
import { ForgotPasswordPageQuery } from '@/lib/page-queries/auth/ForgotPasswordPageQuery';
|
||||
import { ForgotPasswordClient } from './ForgotPasswordClient';
|
||||
import { ForgotPasswordClient } from '@/client-wrapper/ForgotPasswordClient';
|
||||
|
||||
export default async function ForgotPasswordPage({
|
||||
searchParams,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { AuthError } from '@/components/auth/AuthError';
|
||||
import { LoginPageQuery } from '@/lib/page-queries/auth/LoginPageQuery';
|
||||
import { LoginClient } from './LoginClient';
|
||||
import { LoginClient } from '@/client-wrapper/LoginClient';
|
||||
|
||||
export default async function LoginPage({
|
||||
searchParams,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { AuthError } from '@/components/auth/AuthError';
|
||||
import { ResetPasswordPageQuery } from '@/lib/page-queries/auth/ResetPasswordPageQuery';
|
||||
import { ResetPasswordClient } from './ResetPasswordClient';
|
||||
import { ResetPasswordClient } from '@/client-wrapper/ResetPasswordClient';
|
||||
|
||||
export default async function ResetPasswordPage({
|
||||
searchParams,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { AuthError } from '@/components/auth/AuthError';
|
||||
import { SignupPageQuery } from '@/lib/page-queries/auth/SignupPageQuery';
|
||||
import { SignupClient } from './SignupClient';
|
||||
import { SignupClient } from '@/client-wrapper/SignupClient';
|
||||
|
||||
export default async function SignupPage({
|
||||
searchParams,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
import { DriverProfilePageQuery } from '@/lib/page-queries/DriverProfilePageQuery';
|
||||
import { DriverProfilePageClient } from './DriverProfilePageClient';
|
||||
import { DriverProfilePageClient } from '@/client-wrapper/DriverProfilePageClient';
|
||||
|
||||
export default async function DriverProfilePage({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
import { DriversPageQuery } from '@/lib/page-queries/DriversPageQuery';
|
||||
import { DriversPageClient } from './DriversPageClient';
|
||||
import { DriversPageClient } from '@/client-wrapper/DriversPageClient';
|
||||
|
||||
export default async function Page() {
|
||||
const result = await DriversPageQuery.execute();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
import { DriverRankingsPageQuery } from '@/lib/page-queries/DriverRankingsPageQuery';
|
||||
import { DriverRankingsPageClient } from './DriverRankingsPageClient';
|
||||
import { DriverRankingsPageClient } from '@/client-wrapper/DriverRankingsPageClient';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
import { logger } from '@/lib/infrastructure/logging/logger';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
import { LeaderboardsPageQuery } from '@/lib/page-queries/LeaderboardsPageQuery';
|
||||
import { LeaderboardsPageClient } from './LeaderboardsPageClient';
|
||||
import { LeaderboardsPageClient } from '@/client-wrapper/LeaderboardsPageClient';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
import { logger } from '@/lib/infrastructure/logging/logger';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { RosterAdminPage } from './RosterAdminPage';
|
||||
import { RosterAdminPage } from '@/client-wrapper/RosterAdminPage';
|
||||
|
||||
export default function LeagueRosterAdminPage() {
|
||||
return <RosterAdminPage />;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { LeagueScheduleAdminPageQuery } from '@/lib/page-queries/LeagueScheduleAdminPageQuery';
|
||||
import { LeagueAdminSchedulePageClient } from './LeagueAdminSchedulePageClient';
|
||||
import { LeagueAdminSchedulePageClient } from '@/client-wrapper/LeagueAdminSchedulePageClient';
|
||||
|
||||
interface Props {
|
||||
params: Promise<{ id: string }>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LeagueStewardingPageQuery } from '@/lib/page-queries/LeagueStewardingPageQuery';
|
||||
import { StewardingPageClient } from './StewardingPageClient';
|
||||
import { StewardingPageClient } from '@/client-wrapper/StewardingPageClient';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { LeagueProtestDetailPageQuery } from '@/lib/page-queries/LeagueProtestDetailPageQuery';
|
||||
import { ProtestDetailPageClient } from './ProtestDetailPageClient';
|
||||
import { ProtestDetailPageClient } from '@/client-wrapper/ProtestDetailPageClient';
|
||||
|
||||
interface Props {
|
||||
params: Promise<{ id: string; protestId: string }>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LeagueWalletPageQuery } from '@/lib/page-queries/LeagueWalletPageQuery';
|
||||
import { LeagueWalletPageClient } from './LeagueWalletPageClient';
|
||||
import { LeagueWalletPageClient } from '@/client-wrapper/LeagueWalletPageClient';
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
interface Props {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { useRouter, useSearchParams } from 'next/navigation';
|
||||
import { CreateLeagueWizard } from './CreateLeagueWizard';
|
||||
import { CreateLeagueWizard } from '@/client-wrapper/CreateLeagueWizard';
|
||||
import { Section } from '@/ui/Section';
|
||||
import { Container } from '@/ui/Container';
|
||||
import { SearchParamParser } from '@/lib/routing/search-params/SearchParamParser';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { LeaguesPageClient } from './LeaguesPageClient';
|
||||
import { LeaguesPageClient } from '@/client-wrapper/LeaguesPageClient';
|
||||
import { LeaguesPageQuery } from '@/lib/page-queries/LeaguesPageQuery';
|
||||
|
||||
export default async function Page() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { MediaPageClient } from '../MediaPageClient';
|
||||
import { MediaPageClient } from '@/client-wrapper/MediaPageClient';
|
||||
|
||||
export default async function AvatarsPage() {
|
||||
const assets = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { MediaPageClient } from '../MediaPageClient';
|
||||
import { MediaPageClient } from '@/client-wrapper/MediaPageClient';
|
||||
|
||||
export default async function LeaguesMediaPage() {
|
||||
const assets = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { MediaPageClient } from './MediaPageClient';
|
||||
import { MediaPageClient } from '@/client-wrapper/MediaPageClient';
|
||||
|
||||
export default async function MediaPage() {
|
||||
// In a real app, we would fetch this data from an API or database
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { MediaPageClient } from '../MediaPageClient';
|
||||
import { MediaPageClient } from '@/client-wrapper/MediaPageClient';
|
||||
|
||||
export default async function SponsorsMediaPage() {
|
||||
const assets = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { MediaPageClient } from '../MediaPageClient';
|
||||
import { MediaPageClient } from '@/client-wrapper/MediaPageClient';
|
||||
|
||||
export default async function TeamsMediaPage() {
|
||||
const assets = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { MediaPageClient } from '../MediaPageClient';
|
||||
import { MediaPageClient } from '@/client-wrapper/MediaPageClient';
|
||||
|
||||
export default async function TracksMediaPage() {
|
||||
const assets = [
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
import { OnboardingWizardClient } from './OnboardingWizardClient';
|
||||
import { OnboardingWizardClient } from '@/client-wrapper/OnboardingWizardClient';
|
||||
import { OnboardingPageQuery } from '@/lib/page-queries/OnboardingPageQuery';
|
||||
import { SearchParamBuilder } from '@/lib/routing/search-params/SearchParamBuilder';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { ProfileLiveryUploadPageClient } from './ProfileLiveryUploadPageClient';
|
||||
import { ProfileLiveryUploadPageClient } from '@/client-wrapper/ProfileLiveryUploadPageClient';
|
||||
|
||||
export default async function ProfileLiveryUploadPage() {
|
||||
return <ProfileLiveryUploadPageClient />;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ProfilePageQuery } from '@/lib/page-queries/ProfilePageQuery';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { ProfilePageClient } from './ProfilePageClient';
|
||||
import { ProfilePageClient } from '@/client-wrapper/ProfilePageClient';
|
||||
|
||||
export default async function ProfilePage() {
|
||||
const query = new ProfilePageQuery();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ProfilePageQuery } from '@/lib/page-queries/ProfilePageQuery';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { updateProfileAction } from '@/app/actions/profileActions';
|
||||
import { ProfileSettingsPageClient } from './ProfileSettingsPageClient';
|
||||
import { ProfileSettingsPageClient } from '@/client-wrapper/ProfileSettingsPageClient';
|
||||
|
||||
export default async function ProfileSettingsPage() {
|
||||
const query = new ProfilePageQuery();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { SponsorshipRequestsPageQuery } from '@/lib/page-queries/SponsorshipRequestsPageQuery';
|
||||
import { SponsorshipRequestsClient } from './SponsorshipRequestsClient';
|
||||
import { SponsorshipRequestsClient } from '@/client-wrapper/SponsorshipRequestsClient';
|
||||
import { acceptSponsorshipRequest, rejectSponsorshipRequest } from '@/app/actions/sponsorshipActions';
|
||||
|
||||
export default async function SponsorshipRequestsPage() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { PageWrapper } from '@/ui/PageWrapper';
|
||||
import { RaceDetailPageQuery } from '@/lib/page-queries/races/RaceDetailPageQuery';
|
||||
import { RaceDetailPageClient } from './RaceDetailPageClient';
|
||||
import { RaceDetailPageClient } from '@/client-wrapper/RaceDetailPageClient';
|
||||
|
||||
interface RaceDetailPageProps {
|
||||
params: Promise<{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { PageWrapper } from '@/ui/PageWrapper';
|
||||
import { RaceResultsPageQuery } from '@/lib/page-queries/races/RaceResultsPageQuery';
|
||||
import { RaceResultsPageClient } from './RaceResultsPageClient';
|
||||
import { RaceResultsPageClient } from '@/client-wrapper/RaceResultsPageClient';
|
||||
|
||||
interface RaceResultsPageProps {
|
||||
params: Promise<{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { RacesAllPageQuery } from '@/lib/page-queries/races/RacesAllPageQuery';
|
||||
import { RacesAllPageClient } from './RacesAllPageClient';
|
||||
import { RacesAllPageClient } from '@/client-wrapper/RacesAllPageClient';
|
||||
|
||||
export default async function Page() {
|
||||
// Execute the PageQuery
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { RacesPageQuery } from '@/lib/page-queries/races/RacesPageQuery';
|
||||
import { RacesPageClient } from './RacesPageClient';
|
||||
import { RacesPageClient } from '@/client-wrapper/RacesPageClient';
|
||||
|
||||
export default async function Page() {
|
||||
const query = new RacesPageQuery();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { PageWrapper } from '@/ui/PageWrapper';
|
||||
import { SponsorLeagueDetailPageClient } from './SponsorLeagueDetailPageClient';
|
||||
import { SponsorLeagueDetailPageClient } from '@/client-wrapper/SponsorLeagueDetailPageClient';
|
||||
import { SponsorsApiClient } from '@/lib/api/sponsors/SponsorsApiClient';
|
||||
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
|
||||
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { PageWrapper } from '@/ui/PageWrapper';
|
||||
import { SponsorLeaguesPageClient } from './SponsorLeaguesPageClient';
|
||||
import { SponsorLeaguesPageClient } from '@/client-wrapper/SponsorLeaguesPageClient';
|
||||
import { SponsorsApiClient } from '@/lib/api/sponsors/SponsorsApiClient';
|
||||
import { EnhancedErrorReporter } from '@/lib/infrastructure/EnhancedErrorReporter';
|
||||
import { ConsoleLogger } from '@/lib/infrastructure/logging/ConsoleLogger';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { TeamDetailPageQuery } from '@/lib/page-queries/TeamDetailPageQuery';
|
||||
import { TeamDetailPageClient } from './TeamDetailPageClient';
|
||||
import { TeamDetailPageClient } from '@/client-wrapper/TeamDetailPageClient';
|
||||
|
||||
export default async function Page({ params }: { params: Promise<{ id: string }> }) {
|
||||
const { id } = await params;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { TeamLeaderboardPageQuery } from '@/lib/page-queries/TeamLeaderboardPageQuery';
|
||||
import { TeamLeaderboardPageWrapper } from './TeamLeaderboardPageWrapper';
|
||||
import { TeamLeaderboardPageWrapper } from '@/client-wrapper/TeamLeaderboardPageWrapper';
|
||||
|
||||
export default async function TeamLeaderboardPage() {
|
||||
const query = new TeamLeaderboardPageQuery();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { notFound } from 'next/navigation';
|
||||
import { TeamsPageQuery } from '@/lib/page-queries/TeamsPageQuery';
|
||||
import { TeamsPageClient } from './TeamsPageClient';
|
||||
import { TeamsPageClient } from '@/client-wrapper/TeamsPageClient';
|
||||
|
||||
export default async function Page() {
|
||||
const query = new TeamsPageQuery();
|
||||
|
||||
Reference in New Issue
Block a user