arbret/frontend/app/signup/[code]/page.tsx
counterweight 7dd13292a0
Phase 5: Translate Auth Pages - login and signup
- Create auth.json translation files for es, en, ca
- Translate login page: title, subtitle, form labels, buttons, footer
- Translate signup page: invite code step and account creation step
- Translate signup/[code] redirect page
- Update IntlProvider to load auth namespace
- Update test expectations to match Spanish translations (default language)
- All frontend and e2e tests passing
2025-12-25 22:14:04 +01:00

48 lines
1.4 KiB
TypeScript

"use client";
import { useEffect } from "react";
import { useRouter, useParams } from "next/navigation";
import { useAuth } from "../../auth-context";
import { LanguageSelector } from "../../components/LanguageSelector";
import { useTranslation } from "../../hooks/useTranslation";
export default function SignupWithCodePage() {
const params = useParams();
const router = useRouter();
const { user, isLoading } = useAuth();
const code = params.code as string;
const t = useTranslation("auth");
useEffect(() => {
// Wait for auth check to complete before redirecting
if (isLoading) return;
if (user) {
// Already logged in, redirect to home
router.replace("/");
} else {
// Redirect to signup with code as query param
// Invite codes only contain [a-z0-9-] so no encoding needed
router.replace(`/signup?code=${code}`);
}
}, [user, isLoading, code, router]);
return (
<main
style={{
minHeight: "100vh",
display: "flex",
alignItems: "center",
justifyContent: "center",
background: "linear-gradient(135deg, #0f0f23 0%, #1a1a3e 50%, #0f0f23 100%)",
color: "rgba(255,255,255,0.6)",
fontFamily: "'DM Sans', system-ui, sans-serif",
}}
>
<div style={{ position: "absolute", top: "1rem", right: "1rem" }}>
<LanguageSelector />
</div>
{t("signup.redirecting")}
</main>
);
}