code quality
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
This commit is contained in:
@@ -5,7 +5,16 @@ import { DriverProfileTemplate } from '@/templates/DriverProfileTemplate';
|
||||
import { EmptyTemplate, ErrorTemplate } from '@/templates/shared/StatusTemplates';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useState } from 'react';
|
||||
import type { DriverProfileViewData } from '@/lib/view-data/DriverProfileViewData';
|
||||
|
||||
interface DriverProfilePageClientProps {
|
||||
viewData: DriverProfileViewData | null;
|
||||
error?: boolean;
|
||||
empty?: {
|
||||
title: string;
|
||||
description: string;
|
||||
};
|
||||
}
|
||||
|
||||
export function DriverProfilePageClient({ viewData, error, empty }: DriverProfilePageClientProps) {
|
||||
const router = useRouter();
|
||||
|
||||
@@ -5,6 +5,16 @@ import { DriversTemplate } from '@/templates/DriversTemplate';
|
||||
import { EmptyTemplate, ErrorTemplate } from '@/templates/shared/StatusTemplates';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useMemo, useState } from 'react';
|
||||
import type { DriversViewData, DriverViewData } from '@/lib/view-data/DriversViewData';
|
||||
|
||||
interface DriversPageClientProps {
|
||||
viewData: DriversViewData | null;
|
||||
error?: boolean;
|
||||
empty?: {
|
||||
title: string;
|
||||
description: string;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export function DriversPageClient({ viewData, error, empty }: DriversPageClientProps) {
|
||||
@@ -16,8 +26,8 @@ export function DriversPageClient({ viewData, error, empty }: DriversPageClientP
|
||||
if (!searchQuery) return viewData.drivers;
|
||||
|
||||
const query = searchQuery.toLowerCase();
|
||||
return viewData.drivers.filter(driver =>
|
||||
driver.name.toLowerCase().includes(query) ||
|
||||
return viewData.drivers.filter((driver: DriverViewData) =>
|
||||
driver.name.toLowerCase().includes(query) ||
|
||||
driver.nationality.toLowerCase().includes(query)
|
||||
);
|
||||
}, [viewData, searchQuery]);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
'use client';
|
||||
|
||||
import { ForgotPasswordViewModelBuilder } from '@/lib/builders/view-models/ForgotPasswordViewModelBuilder';
|
||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||
import { ForgotPasswordMutation } from '@/lib/mutations/auth/ForgotPasswordMutation';
|
||||
import { ForgotPasswordFormValidation } from '@/lib/utilities/authValidation';
|
||||
@@ -18,7 +17,7 @@ import { useState } from 'react';
|
||||
export function ForgotPasswordClient({ viewData }: ClientWrapperProps<ForgotPasswordViewData>) {
|
||||
// Build ViewModel from ViewData
|
||||
const [viewModel, setViewModel] = useState<ForgotPasswordViewModel>(() =>
|
||||
ForgotPasswordViewModelBuilder.build(viewData)
|
||||
new ForgotPasswordViewModel(viewData.returnTo, viewData.formState)
|
||||
);
|
||||
|
||||
// Handle form field changes
|
||||
@@ -114,7 +113,7 @@ export function ForgotPasswordClient({ viewData }: ClientWrapperProps<ForgotPass
|
||||
setShowSuccess: (show) => {
|
||||
if (!show) {
|
||||
// Reset to initial state
|
||||
setViewModel(() => ForgotPasswordViewModelBuilder.build(viewData));
|
||||
setViewModel(() => new ForgotPasswordViewModel(viewData.returnTo, viewData.formState));
|
||||
}
|
||||
},
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Login Client Component
|
||||
*
|
||||
*
|
||||
* Handles client-side login flow using the LoginFlowController.
|
||||
* Deterministic state machine per docs/architecture/website/LOGIN_FLOW_STATE_MACHINE.md
|
||||
*/
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
import { useAuth } from '@/components/auth/AuthContext';
|
||||
import { LoginFlowController, LoginState } from '@/lib/auth/LoginFlowController';
|
||||
import { LoginViewModelBuilder } from '@/lib/builders/view-models/LoginViewModelBuilder';
|
||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||
import { LoginMutation } from '@/lib/mutations/auth/LoginMutation';
|
||||
import { validateLoginForm, type LoginFormValues } from '@/lib/utils/validation';
|
||||
@@ -26,8 +25,13 @@ export function LoginClient({ viewData }: ClientWrapperProps<LoginViewData>) {
|
||||
const { refreshSession, session } = useAuth();
|
||||
|
||||
// Build ViewModel from ViewData
|
||||
const [viewModel, setViewModel] = useState<LoginViewModel>(() =>
|
||||
LoginViewModelBuilder.build(viewData)
|
||||
const [viewModel, setViewModel] = useState<LoginViewModel>(() =>
|
||||
new LoginViewModel(
|
||||
viewData.returnTo,
|
||||
viewData.hasInsufficientPermissions,
|
||||
viewData.formState,
|
||||
{ showPassword: viewData.showPassword, showErrorDetails: viewData.showErrorDetails }
|
||||
)
|
||||
);
|
||||
|
||||
// Login flow controller
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
'use client';
|
||||
|
||||
import { ResetPasswordViewModelBuilder } from '@/lib/builders/view-models/ResetPasswordViewModelBuilder';
|
||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||
import { ResetPasswordMutation } from '@/lib/mutations/auth/ResetPasswordMutation';
|
||||
import { routes } from '@/lib/routing/RouteConfig';
|
||||
@@ -23,7 +22,12 @@ export function ResetPasswordClient({ viewData }: ClientWrapperProps<ResetPasswo
|
||||
|
||||
// Build ViewModel from ViewData
|
||||
const [viewModel, setViewModel] = useState<ResetPasswordViewModel>(() =>
|
||||
ResetPasswordViewModelBuilder.build(viewData)
|
||||
new ResetPasswordViewModel(
|
||||
viewData.token,
|
||||
viewData.returnTo,
|
||||
viewData.formState,
|
||||
{ showPassword: false, showConfirmPassword: false }
|
||||
)
|
||||
);
|
||||
|
||||
// Handle form field changes
|
||||
@@ -151,7 +155,12 @@ export function ResetPasswordClient({ viewData }: ClientWrapperProps<ResetPasswo
|
||||
setShowSuccess: (show) => {
|
||||
if (!show) {
|
||||
// Reset to initial state
|
||||
setViewModel(() => ResetPasswordViewModelBuilder.build(viewData));
|
||||
setViewModel(() => new ResetPasswordViewModel(
|
||||
viewData.token,
|
||||
viewData.returnTo,
|
||||
viewData.formState,
|
||||
{ showPassword: false, showConfirmPassword: false }
|
||||
));
|
||||
}
|
||||
},
|
||||
setShowPassword: togglePassword,
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
'use client';
|
||||
|
||||
import { useAuth } from '@/components/auth/AuthContext';
|
||||
import { SignupViewModelBuilder } from '@/lib/builders/view-models/SignupViewModelBuilder';
|
||||
import { ClientWrapperProps } from '@/lib/contracts/components/ComponentContracts';
|
||||
import { SignupMutation } from '@/lib/mutations/auth/SignupMutation';
|
||||
import { SignupFormValidation } from '@/lib/utilities/authValidation';
|
||||
@@ -24,7 +23,11 @@ export function SignupClient({ viewData }: ClientWrapperProps<SignupViewData>) {
|
||||
|
||||
// Build ViewModel from ViewData
|
||||
const [viewModel, setViewModel] = useState<SignupViewModel>(() =>
|
||||
SignupViewModelBuilder.build(viewData)
|
||||
new SignupViewModel(
|
||||
viewData.returnTo,
|
||||
viewData.formState,
|
||||
{ showPassword: false, showConfirmPassword: false }
|
||||
)
|
||||
);
|
||||
|
||||
// Handle form field changes
|
||||
|
||||
Reference in New Issue
Block a user