diff --git a/src/pages/RegisterPage.tsx b/src/pages/RegisterPage.tsx new file mode 100644 index 0000000..8011cba --- /dev/null +++ b/src/pages/RegisterPage.tsx @@ -0,0 +1,83 @@ +import { useState } from "react" +import { Link, useNavigate } from "react-router-dom" +import { useTranslation } from "react-i18next" +import { useAuth } from "@/hooks/useAuth" +import { Button } from "@/components/ui/button" +import { Input } from "@/components/ui/input" +import { Label } from "@/components/ui/label" +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" + +export default function RegisterPage() { + const { t } = useTranslation() + const { signUp } = useAuth() + const navigate = useNavigate() + const [email, setEmail] = useState("") + const [password, setPassword] = useState("") + const [error, setError] = useState("") + const [loading, setLoading] = useState(false) + + async function handleSubmit(e: React.FormEvent) { + e.preventDefault() + setError("") + setLoading(true) + try { + await signUp(email, password) + navigate("/") + } catch (err) { + setError(err instanceof Error ? err.message : t("common.error")) + } finally { + setLoading(false) + } + } + + return ( +
{t("auth.registerSubtitle")}
++ {t("auth.hasAccount")}{" "} + + {t("auth.login")} + +
+