import React, { useState } from "react"; import { Sparkles, Mail, Lock, User, PawPrint } from "lucide-react"; import { useAuth } from "../context/AuthContext"; export const AuthPage: React.FC = () => { const { login, register } = useAuth(); const [isRegistering, setIsRegistering] = useState(false); const [username, setUsername] = useState(""); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setError(""); setLoading(true); try { if (isRegistering) { await register(username, email, password); } else { await login(email, password); } } catch (err: any) { setError(err.message || "Something went wrong"); } finally { setLoading(false); } }; return (
{/* Logo */}

PetTalk

Understanding pet intent softly

{/* Form Card */}

{isRegistering ? "Create Account" : "Welcome Back"}

{error && (
{error}
)}
{isRegistering && (
setUsername(e.target.value)} placeholder="Your name" required className="w-full pl-10 pr-4 py-2.5 rounded-xl border border-[#E5DFD3] bg-[#F9F7F2] text-[#1A2A40] text-sm placeholder:text-[#5A6E85] focus:outline-none focus:ring-2 focus:ring-[#F08C7D]/40 focus:border-[#F08C7D]/50 transition-all" />
)}
setEmail(e.target.value)} placeholder="you@example.com" required className="w-full pl-10 pr-4 py-2.5 rounded-xl border border-[#E5DFD3] bg-[#F9F7F2] text-[#1A2A40] text-sm placeholder:text-[#5A6E85] focus:outline-none focus:ring-2 focus:ring-[#F08C7D]/40 focus:border-[#F08C7D]/50 transition-all" />
setPassword(e.target.value)} placeholder="Min 6 characters" required minLength={6} className="w-full pl-10 pr-4 py-2.5 rounded-xl border border-[#E5DFD3] bg-[#F9F7F2] text-[#1A2A40] text-sm placeholder:text-[#5A6E85] focus:outline-none focus:ring-2 focus:ring-[#F08C7D]/40 focus:border-[#F08C7D]/50 transition-all" />
{/* Footer */}

PetTalk AI ยท Probabilistic Pet Behavioral Interpretation

); };