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" import { Separator } from "@/components/ui/separator" export default function LoginPage() { const { t } = useTranslation() const { signIn, signInWithOAuth } = 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 signIn(email, password) navigate("/") } catch (err) { setError(err instanceof Error ? err.message : t("common.error")) } finally { setLoading(false) } } return (
{t("auth.loginSubtitle")}
{t("auth.noAccount")}{" "} {t("auth.register")}