import { zodResolver } from "@hookform/resolvers/zod"; import { t, Trans } from "@lingui/macro"; import { ArrowRight } from "@phosphor-icons/react"; import { registerSchema } from "@reactive-resume/dto"; import { usePasswordToggle } from "@reactive-resume/hooks"; import { Alert, AlertTitle, Button, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Input, } from "@reactive-resume/ui"; import { cn } from "@reactive-resume/utils"; import { useRef } from "react"; import { Helmet } from "react-helmet-async"; import { useForm } from "react-hook-form"; import { Link, useNavigate } from "react-router"; import { z } from "zod"; import { useRegister } from "@/client/services/auth"; import { useFeatureFlags } from "@/client/services/feature"; type FormValues = z.infer; export const RegisterPage = () => { const navigate = useNavigate(); const { flags } = useFeatureFlags(); const { register, loading } = useRegister(); const formRef = useRef(null); usePasswordToggle(formRef); const form = useForm({ resolver: zodResolver(registerSchema), defaultValues: { name: "", username: "", email: "", password: "", locale: "en-US", }, }); const onSubmit = async (data: FormValues) => { try { await register(data); void navigate("/auth/verify-email"); } catch { form.reset(); } }; return (
{t`Create a new account`} - {t`Reactive Resume`}

{t`Create a new account`}

{t`Already have an account?`}
{flags.isSignupsDisabled && ( {t`Signups are currently disabled by the administrator.`} )}
( {t`Name`} )} /> ( {t`Username`} )} /> ( {t`Email`} )} /> ( {t`Password`} Hold Ctrl to display your password temporarily. )} />
); };