Update homepage routes to include language and mode
Build & Deploy / Build & Push Docker Image (push) Successful in 2m51s
Test / Type Check (all packages) (push) Successful in 52s
Build & Deploy / Deploy to VPS (push) Successful in 4s
Test / API Unit Tests (push) Successful in 49s
Test / Homepage Unit Tests (push) Successful in 44s
Test / Storefront Unit Tests (push) Successful in 39s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 40s
Test / API Integration Tests (push) Successful in 1m0s

This commit is contained in:
root
2026-07-02 14:10:17 -04:00
parent 56c3bcf666
commit 781512399b
51 changed files with 792 additions and 344 deletions
@@ -1,7 +1,8 @@
'use client'
import { localizedPath, type Locale } from '@/lib/localization/config'
import { localizedModePath, modeFromPathname, type Locale } from '@/lib/localization/config'
import Image from 'next/image'
import { usePathname } from 'next/navigation'
import type { ReactNode } from 'react'
import styles from './AuthShell.module.css'
@@ -13,6 +14,7 @@ interface AuthShellProps {
}
export function AuthShell({ locale, title, subtitle, children }: AuthShellProps) {
const mode = modeFromPathname(usePathname())
return (
<main
id="main-content"
@@ -21,7 +23,7 @@ export function AuthShell({ locale, title, subtitle, children }: AuthShellProps)
>
<div className={styles.container}>
<div className={styles.header}>
<a href={localizedPath('home', locale)}>
<a href={localizedModePath('home', locale, mode)}>
<Image
src="/rentaldrivego.png"
alt="RentalDriveGo"
@@ -5,7 +5,8 @@ import { TextInput } from '@/components/forms/TextInput'
import { FormField } from '@/components/forms/FormField'
import { AuthShell } from '@/components/auth/AuthShell'
import { API_BASE } from '@/lib/api'
import { localizedPath, type Locale } from '@/lib/localization/config'
import { localizedModePath, modeFromPathname, type Locale } from '@/lib/localization/config'
import { usePathname } from 'next/navigation'
import { useState } from 'react'
import styles from './AuthForms.module.css'
@@ -63,6 +64,7 @@ const dicts: Record<string, Dict> = {
export function ForgotPasswordForm({ locale }: { locale: Locale }) {
const dict = (dicts[locale] ?? dicts.en) as Dict
const mode = modeFromPathname(usePathname())
const [email, setEmail] = useState('')
const [loading, setLoading] = useState(false)
const [sent, setSent] = useState(false)
@@ -94,7 +96,7 @@ export function ForgotPasswordForm({ locale }: { locale: Locale }) {
}
}
const signInHref = localizedPath('sign-in', locale)
const signInHref = localizedModePath('sign-in', locale, mode)
return (
<AuthShell locale={locale} title={dict.title} subtitle={dict.subtitle}>
@@ -4,8 +4,8 @@ import { Button } from '@/components/actions/Button';
import { FormField } from '@/components/forms/FormField';
import { AuthShell } from '@/components/auth/AuthShell';
import { API_BASE } from '@/lib/api';
import { localizedPath, type Locale } from '@/lib/localization/config';
import { useSearchParams } from 'next/navigation';
import { localizedModePath, modeFromPathname, type Locale } from '@/lib/localization/config';
import { usePathname, useSearchParams } from 'next/navigation';
import { Suspense, useState } from 'react';
import styles from './AuthForms.module.css';
@@ -88,6 +88,7 @@ const dicts: Record<string, Dict> = {
function ResetPasswordContent({ locale }: { locale: Locale }) {
const dict = (dicts[locale] ?? dicts.en) as Dict;
const searchParams = useSearchParams();
const mode = modeFromPathname(usePathname());
const token = searchParams.get('token');
const [password, setPassword] = useState('');
@@ -139,8 +140,8 @@ function ResetPasswordContent({ locale }: { locale: Locale }) {
}
}
const signInHref = localizedPath('sign-in', locale);
const forgotHref = localizedPath('forgot-password', locale);
const signInHref = localizedModePath('sign-in', locale, mode);
const forgotHref = localizedModePath('forgot-password', locale, mode);
if (!token) {
return (
@@ -6,8 +6,8 @@ import { FormField } from '@/components/forms/FormField';
import { AuthShell } from '@/components/auth/AuthShell';
import { API_BASE, EMPLOYEE_PROFILE_KEY } from '@/lib/api';
import { classNames } from '@/lib/components/classNames';
import { localizedPath, type Locale } from '@/lib/localization/config';
import { useSearchParams } from 'next/navigation';
import { localizedModePath, modeFromPathname, type Locale } from '@/lib/localization/config';
import { usePathname, useSearchParams } from 'next/navigation';
import { useState } from 'react';
import styles from './AuthForms.module.css';
@@ -104,6 +104,7 @@ const dicts: Record<string, Dict> = {
export function SignInForm({ locale }: { locale: Locale }) {
const dict = (dicts[locale] ?? dicts.en) as Dict;
const searchParams = useSearchParams();
const mode = modeFromPathname(usePathname());
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [showPassword, setShowPassword] = useState(false);
@@ -236,7 +237,7 @@ export function SignInForm({ locale }: { locale: Locale }) {
}
}
const hrefBase = localizedPath('forgot-password', locale);
const hrefBase = localizedModePath('forgot-password', locale, mode);
return (
<AuthShell locale={locale} title={dict.title} subtitle={dict.subtitle}>