Phase 2: Language Context & Selector - Add language dropdown to Header and auth pages

- Create LanguageSelector component with dropdown (shows flag + name)
- Add LanguageSelector to Header (right side, near user email/logout)
- Add LanguageSelector to login, signup, and signup/[code] pages
- Create test-utils.tsx with renderWithProviders helper
- Add vitest.setup.ts to mock localStorage
- Update all test files to use renderWithProviders
- Language selector persists choice in localStorage
- HTML lang attribute updates dynamically based on selected language

All frontend and e2e tests passing.
This commit is contained in:
counterweight 2025-12-25 21:54:19 +01:00
parent f7553df05d
commit f86ec8b62d
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
11 changed files with 214 additions and 37 deletions

View file

@ -5,6 +5,7 @@ import { useRouter, useSearchParams } from "next/navigation";
import { useAuth } from "../auth-context";
import { invitesApi } from "../api";
import { authFormStyles as styles } from "../styles/auth-form";
import { LanguageSelector } from "../components/LanguageSelector";
function SignupContent() {
const searchParams = useSearchParams();
@ -107,6 +108,9 @@ function SignupContent() {
if (isCheckingInitialCode) {
return (
<main style={styles.main}>
<div style={{ position: "absolute", top: "1rem", right: "1rem" }}>
<LanguageSelector />
</div>
<div style={styles.container}>
<div style={styles.card}>
<div style={{ textAlign: "center", color: "rgba(255,255,255,0.6)" }}>
@ -122,6 +126,9 @@ function SignupContent() {
if (!inviteValid) {
return (
<main style={styles.main}>
<div style={{ position: "absolute", top: "1rem", right: "1rem" }}>
<LanguageSelector />
</div>
<div style={styles.container}>
<div style={styles.card}>
<div style={styles.header}>
@ -189,6 +196,9 @@ function SignupContent() {
// Step 2: Enter email and password
return (
<main style={styles.main}>
<div style={{ position: "absolute", top: "1rem", right: "1rem" }}>
<LanguageSelector />
</div>
<div style={styles.container}>
<div style={styles.card}>
<div style={styles.header}>