view data fixes
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { notFound } from 'next/navigation';
|
|
||||||
import { PageWrapper } from '@/components/shared/state/PageWrapper';
|
import { PageWrapper } from '@/components/shared/state/PageWrapper';
|
||||||
import { RaceStewardingTemplate, type StewardingTab } from '@/templates/RaceStewardingTemplate';
|
|
||||||
import { RaceStewardingPageQuery } from '@/lib/page-queries/races/RaceStewardingPageQuery';
|
import { RaceStewardingPageQuery } from '@/lib/page-queries/races/RaceStewardingPageQuery';
|
||||||
import { type RaceStewardingViewData } from '@/lib/view-data/races/RaceStewardingViewData';
|
import { type RaceStewardingViewData } from '@/lib/view-data/RaceStewardingViewData';
|
||||||
|
import { RaceStewardingTemplate, type StewardingTab } from '@/templates/RaceStewardingTemplate';
|
||||||
import { Gavel } from 'lucide-react';
|
import { Gavel } from 'lucide-react';
|
||||||
import { useState, useEffect, useCallback, use } from 'react';
|
import { notFound } from 'next/navigation';
|
||||||
|
import { use, useCallback, useEffect, useState } from 'react';
|
||||||
|
|
||||||
interface RaceStewardingPageProps {
|
interface RaceStewardingPageProps {
|
||||||
params: Promise<{
|
params: Promise<{
|
||||||
|
|||||||
@@ -1,21 +1,11 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import type { ProfileTab } from '@/components/profile/ProfileTabs';
|
import type { ProfileTab } from '@/components/profile/ProfileTabs';
|
||||||
import type { DriverProfileViewData } from '@/lib/types/view-data/DriverProfileViewData';
|
|
||||||
import { DriverProfileTemplate } from '@/templates/DriverProfileTemplate';
|
import { DriverProfileTemplate } from '@/templates/DriverProfileTemplate';
|
||||||
import { ErrorTemplate, EmptyTemplate } from '@/templates/shared/StatusTemplates';
|
import { EmptyTemplate, ErrorTemplate } from '@/templates/shared/StatusTemplates';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
|
||||||
|
|
||||||
interface DriverProfilePageClientProps {
|
|
||||||
viewData: DriverProfileViewData | null;
|
|
||||||
error?: string;
|
|
||||||
empty?: {
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function DriverProfilePageClient({ viewData, error, empty }: DriverProfilePageClientProps) {
|
export function DriverProfilePageClient({ viewData, error, empty }: DriverProfilePageClientProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -1,21 +1,11 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import type { DriversViewData } from '@/lib/types/view-data/DriversViewData';
|
import { routes } from '@/lib/routing/RouteConfig';
|
||||||
import { DriversTemplate } from '@/templates/DriversTemplate';
|
import { DriversTemplate } from '@/templates/DriversTemplate';
|
||||||
import { ErrorTemplate, EmptyTemplate } from '@/templates/shared/StatusTemplates';
|
import { EmptyTemplate, ErrorTemplate } from '@/templates/shared/StatusTemplates';
|
||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { routes } from '@/lib/routing/RouteConfig';
|
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
|
||||||
|
|
||||||
interface DriversPageClientProps {
|
|
||||||
viewData: DriversViewData | null;
|
|
||||||
error?: string;
|
|
||||||
empty?: {
|
|
||||||
title: string;
|
|
||||||
description: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function DriversPageClient({ viewData, error, empty }: DriversPageClientProps) {
|
export function DriversPageClient({ viewData, error, empty }: DriversPageClientProps) {
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
|
|||||||
@@ -6,14 +6,14 @@
|
|||||||
|
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
|
||||||
import { ForgotPasswordViewData } from '@/lib/builders/view-data/types/ForgotPasswordViewData';
|
|
||||||
import { ForgotPasswordTemplate } from '@/templates/auth/ForgotPasswordTemplate';
|
|
||||||
import { ForgotPasswordMutation } from '@/lib/mutations/auth/ForgotPasswordMutation';
|
|
||||||
import { ForgotPasswordViewModelBuilder } from '@/lib/builders/view-models/ForgotPasswordViewModelBuilder';
|
import { ForgotPasswordViewModelBuilder } from '@/lib/builders/view-models/ForgotPasswordViewModelBuilder';
|
||||||
import { ForgotPasswordViewModel } from '@/lib/view-models/auth/ForgotPasswordViewModel';
|
|
||||||
import { ForgotPasswordFormValidation } from '@/lib/utilities/authValidation';
|
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||||
|
import { ForgotPasswordMutation } from '@/lib/mutations/auth/ForgotPasswordMutation';
|
||||||
|
import { ForgotPasswordFormValidation } from '@/lib/utilities/authValidation';
|
||||||
|
import { ForgotPasswordViewData } from '@/lib/view-data/ForgotPasswordViewData';
|
||||||
|
import { ForgotPasswordViewModel } from '@/lib/view-models/auth/ForgotPasswordViewModel';
|
||||||
|
import { ForgotPasswordTemplate } from '@/templates/auth/ForgotPasswordTemplate';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
export function ForgotPasswordClient({ viewData }: ClientWrapperProps<ForgotPasswordViewData>) {
|
export function ForgotPasswordClient({ viewData }: ClientWrapperProps<ForgotPasswordViewData>) {
|
||||||
// Build ViewModel from ViewData
|
// Build ViewModel from ViewData
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import type { LeagueWalletViewData } from '@/lib/view-data/leagues/LeagueWalletViewData';
|
|
||||||
import { LeagueWalletTemplate } from '@/templates/LeagueWalletTemplate';
|
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||||
|
import type { LeagueWalletViewData } from '@/lib/view-data/LeagueWalletViewData';
|
||||||
|
import { LeagueWalletTemplate } from '@/templates/LeagueWalletTemplate';
|
||||||
|
|
||||||
interface LeagueWalletPageClientProps extends ClientWrapperProps<LeagueWalletViewData> {
|
interface LeagueWalletPageClientProps extends ClientWrapperProps<LeagueWalletViewData> {
|
||||||
onWithdraw?: (amount: number) => void;
|
onWithdraw?: (amount: number) => void;
|
||||||
|
|||||||
@@ -9,16 +9,16 @@
|
|||||||
|
|
||||||
import { useAuth } from '@/components/auth/AuthContext';
|
import { useAuth } from '@/components/auth/AuthContext';
|
||||||
import { LoginFlowController, LoginState } from '@/lib/auth/LoginFlowController';
|
import { LoginFlowController, LoginState } from '@/lib/auth/LoginFlowController';
|
||||||
import { LoginViewData } from '@/lib/builders/view-data/types/LoginViewData';
|
|
||||||
import { LoginViewModelBuilder } from '@/lib/builders/view-models/LoginViewModelBuilder';
|
import { LoginViewModelBuilder } from '@/lib/builders/view-models/LoginViewModelBuilder';
|
||||||
|
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||||
import { LoginMutation } from '@/lib/mutations/auth/LoginMutation';
|
import { LoginMutation } from '@/lib/mutations/auth/LoginMutation';
|
||||||
import { validateLoginForm, type LoginFormValues } from '@/lib/utils/validation';
|
import { validateLoginForm, type LoginFormValues } from '@/lib/utils/validation';
|
||||||
|
import { LoginViewData } from '@/lib/view-data/LoginViewData';
|
||||||
import { LoginViewModel } from '@/lib/view-models/auth/LoginViewModel';
|
import { LoginViewModel } from '@/lib/view-models/auth/LoginViewModel';
|
||||||
import { LoginTemplate } from '@/templates/auth/LoginTemplate';
|
|
||||||
import { LoginLoadingTemplate } from '@/templates/auth/LoginLoadingTemplate';
|
import { LoginLoadingTemplate } from '@/templates/auth/LoginLoadingTemplate';
|
||||||
|
import { LoginTemplate } from '@/templates/auth/LoginTemplate';
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
|
||||||
|
|
||||||
export function LoginClient({ viewData }: ClientWrapperProps<LoginViewData>) {
|
export function LoginClient({ viewData }: ClientWrapperProps<LoginViewData>) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React, { useState, useCallback } from 'react';
|
|
||||||
import { RaceResultsTemplate } from '@/templates/RaceResultsTemplate';
|
|
||||||
import { RaceResultsViewData } from '@/lib/view-data/races/RaceResultsViewData';
|
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||||
|
import { RaceResultsViewData } from '@/lib/view-data/RaceResultsViewData';
|
||||||
|
import { RaceResultsTemplate } from '@/templates/RaceResultsTemplate';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
import { useCallback, useState } from 'react';
|
||||||
|
|
||||||
export function RaceResultsPageClient({ viewData }: ClientWrapperProps<RaceResultsViewData>) {
|
export function RaceResultsPageClient({ viewData }: ClientWrapperProps<RaceResultsViewData>) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -6,16 +6,16 @@
|
|||||||
|
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import { ResetPasswordViewData } from '@/lib/builders/view-data/types/ResetPasswordViewData';
|
|
||||||
import { ResetPasswordTemplate } from '@/templates/auth/ResetPasswordTemplate';
|
|
||||||
import { ResetPasswordMutation } from '@/lib/mutations/auth/ResetPasswordMutation';
|
|
||||||
import { ResetPasswordViewModelBuilder } from '@/lib/builders/view-models/ResetPasswordViewModelBuilder';
|
import { ResetPasswordViewModelBuilder } from '@/lib/builders/view-models/ResetPasswordViewModelBuilder';
|
||||||
import { ResetPasswordViewModel } from '@/lib/view-models/auth/ResetPasswordViewModel';
|
|
||||||
import { ResetPasswordFormValidation } from '@/lib/utilities/authValidation';
|
|
||||||
import { routes } from '@/lib/routing/RouteConfig';
|
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||||
|
import { ResetPasswordMutation } from '@/lib/mutations/auth/ResetPasswordMutation';
|
||||||
|
import { routes } from '@/lib/routing/RouteConfig';
|
||||||
|
import { ResetPasswordFormValidation } from '@/lib/utilities/authValidation';
|
||||||
|
import { ResetPasswordViewData } from '@/lib/view-data/ResetPasswordViewData';
|
||||||
|
import { ResetPasswordViewModel } from '@/lib/view-models/auth/ResetPasswordViewModel';
|
||||||
|
import { ResetPasswordTemplate } from '@/templates/auth/ResetPasswordTemplate';
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
export function ResetPasswordClient({ viewData }: ClientWrapperProps<ResetPasswordViewData>) {
|
export function ResetPasswordClient({ viewData }: ClientWrapperProps<ResetPasswordViewData>) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -6,16 +6,16 @@
|
|||||||
|
|
||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useState } from 'react';
|
|
||||||
import { useRouter, useSearchParams } from 'next/navigation';
|
|
||||||
import { useAuth } from '@/components/auth/AuthContext';
|
import { useAuth } from '@/components/auth/AuthContext';
|
||||||
import { SignupViewData } from '@/lib/builders/view-data/types/SignupViewData';
|
|
||||||
import { SignupTemplate } from '@/templates/auth/SignupTemplate';
|
|
||||||
import { SignupMutation } from '@/lib/mutations/auth/SignupMutation';
|
|
||||||
import { SignupViewModelBuilder } from '@/lib/builders/view-models/SignupViewModelBuilder';
|
import { SignupViewModelBuilder } from '@/lib/builders/view-models/SignupViewModelBuilder';
|
||||||
import { SignupViewModel } from '@/lib/view-models/auth/SignupViewModel';
|
|
||||||
import { SignupFormValidation } from '@/lib/utilities/authValidation';
|
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||||
|
import { SignupMutation } from '@/lib/mutations/auth/SignupMutation';
|
||||||
|
import { SignupFormValidation } from '@/lib/utilities/authValidation';
|
||||||
|
import { SignupViewData } from '@/lib/view-data/SignupViewData';
|
||||||
|
import { SignupViewModel } from '@/lib/view-models/auth/SignupViewModel';
|
||||||
|
import { SignupTemplate } from '@/templates/auth/SignupTemplate';
|
||||||
|
import { useRouter, useSearchParams } from 'next/navigation';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
export function SignupClient({ viewData }: ClientWrapperProps<SignupViewData>) {
|
export function SignupClient({ viewData }: ClientWrapperProps<SignupViewData>) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useLeagueStewardingMutations } from "@/hooks/league/useLeagueStewardingMutations";
|
import { useLeagueStewardingMutations } from "@/hooks/league/useLeagueStewardingMutations";
|
||||||
import type { StewardingViewData } from '@/lib/view-data/leagues/StewardingViewData';
|
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||||
|
import type { StewardingViewData } from '@/lib/view-data/StewardingViewData';
|
||||||
import { DriverViewModel } from '@/lib/view-models/DriverViewModel';
|
import { DriverViewModel } from '@/lib/view-models/DriverViewModel';
|
||||||
import { ProtestViewModel } from '@/lib/view-models/ProtestViewModel';
|
import { ProtestViewModel } from '@/lib/view-models/ProtestViewModel';
|
||||||
import { RaceViewModel } from '@/lib/view-models/RaceViewModel';
|
import { RaceViewModel } from '@/lib/view-models/RaceViewModel';
|
||||||
import { useMemo, useState } from 'react';
|
|
||||||
import { StewardingTemplate } from '@/templates/StewardingTemplate';
|
import { StewardingTemplate } from '@/templates/StewardingTemplate';
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
import { useMemo, useState } from 'react';
|
||||||
|
|
||||||
interface StewardingPageClientProps extends ClientWrapperProps<StewardingViewData> {
|
interface StewardingPageClientProps extends ClientWrapperProps<StewardingViewData> {
|
||||||
leagueId: string;
|
leagueId: string;
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { useRouter } from 'next/navigation';
|
|
||||||
import { TeamLeaderboardTemplate } from '@/templates/TeamLeaderboardTemplate';
|
|
||||||
import { useState } from 'react';
|
|
||||||
import type { TeamSummaryViewModel } from '@/lib/view-models/TeamSummaryViewModel';
|
|
||||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||||
import { ViewData } from '@/lib/contracts/view-data/ViewData';
|
import { ViewData } from '@/lib/contracts/view-data/ViewData';
|
||||||
|
import type { TeamSummaryViewModel } from '@/lib/view-models/TeamSummaryViewModel';
|
||||||
|
import { TeamLeaderboardTemplate } from '@/templates/TeamLeaderboardTemplate';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
import { useState } from 'react';
|
||||||
|
|
||||||
type SkillLevel = 'pro' | 'advanced' | 'intermediate' | 'beginner';
|
type SkillLevel = 'pro' | 'advanced' | 'intermediate' | 'beginner';
|
||||||
type SortBy = 'rating' | 'wins' | 'winRate' | 'races';
|
type SortBy = 'rating' | 'wins' | 'winRate' | 'races';
|
||||||
|
|
||||||
interface TeamLeaderboardViewData extends ViewData {
|
interface TeamLeaderboardViewData extends ViewData extends ViewData {
|
||||||
teams: TeamSummaryViewModel[];
|
teams: TeamSummaryViewModel[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { DriverProfileViewDataBuilder } from '@/lib/builders/view-data/DriverProfileViewDataBuilder';
|
||||||
import { Result } from '@/lib/contracts/Result';
|
import { Result } from '@/lib/contracts/Result';
|
||||||
import { DriverProfilePageService } from '@/lib/services/drivers/DriverProfilePageService';
|
import { DriverProfilePageService } from '@/lib/services/drivers/DriverProfilePageService';
|
||||||
import { DriverProfileViewDataBuilder } from '@/lib/builders/view-data/DriverProfileViewDataBuilder';
|
import type { DriverProfileViewData } from '@/lib/view-data/DriverProfileViewData';
|
||||||
import type { DriverProfileViewData } from '@/lib/types/view-data/DriverProfileViewData';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DriverProfilePageQuery
|
* DriverProfilePageQuery
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import { DriversViewDataBuilder } from '@/lib/builders/view-data/DriversViewDataBuilder';
|
||||||
import { Result } from '@/lib/contracts/Result';
|
import { Result } from '@/lib/contracts/Result';
|
||||||
import { DriversPageService } from '@/lib/services/drivers/DriversPageService';
|
import { DriversPageService } from '@/lib/services/drivers/DriversPageService';
|
||||||
import { DriversViewDataBuilder } from '@/lib/builders/view-data/DriversViewDataBuilder';
|
import type { DriversViewData } from '@/lib/view-data/DriversViewData';
|
||||||
import type { DriversViewData } from '@/lib/types/view-data/DriversViewData';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DriversPageQuery
|
* DriversPageQuery
|
||||||
|
|||||||
21
apps/website/lib/view-data/AdminUserViewData.ts
Normal file
21
apps/website/lib/view-data/AdminUserViewData.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import { ViewData } from '@/lib/contracts/view-data/ViewData';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AdminUserViewData
|
||||||
|
*
|
||||||
|
* ViewData for AdminUserViewModel.
|
||||||
|
* Template-ready data structure with only primitives.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export interface AdminUserViewData extends ViewData {
|
||||||
|
id: string;
|
||||||
|
email: string;
|
||||||
|
displayName: string;
|
||||||
|
roles: string[];
|
||||||
|
status: string;
|
||||||
|
isSystemAdmin: boolean;
|
||||||
|
createdAt: string;
|
||||||
|
updatedAt: string;
|
||||||
|
lastLoginAt?: string;
|
||||||
|
primaryDriverId?: string;
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
export interface DriverProfileViewData {
|
import { ViewData } from "@/lib/contracts/view-data/ViewData";
|
||||||
|
|
||||||
|
export interface DriverProfileViewData extends ViewData {
|
||||||
currentDriver: {
|
currentDriver: {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
export interface DriversViewData {
|
import { ViewData } from "@/lib/contracts/view-data/ViewData";
|
||||||
|
|
||||||
|
export interface DriversViewData extends ViewData {
|
||||||
drivers: {
|
drivers: {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
Reference in New Issue
Block a user