diff --git a/src/pages/Login.tsx b/src/pages/Login.tsx new file mode 100644 index 0000000..6bdffc7 --- /dev/null +++ b/src/pages/Login.tsx @@ -0,0 +1,96 @@ +import { useState } from "react"; +import { toast } from "sonner"; +import { Link, useNavigate } from "react-router-dom"; +import { Button } from "@/components/ui/button"; +import { Card, CardContent } from "@/components/ui/card"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { Separator } from "@/components/ui/separator"; +import { Layers, CheckCircle2 } from "lucide-react"; +import { useAuth } from "@/hooks/use-tygarun"; + +export default function LoginPage() { + const navigate = useNavigate(); + const { signin, loading } = useAuth(); + const [email, setEmail] = useState(""); + const [password, setPassword] = useState(""); + const [success, setSuccess] = useState(false); + + return ( +
+
+ {/* Logo */} + +
+ +
+ Nexus + + + + +
+

Welcome back

+

Sign in to your account to continue

+
+ + {success && ( +
+ Sign in successful! Redirecting... +
+ )} + +
{ e.preventDefault(); try { await signin(email, password); setSuccess(true); toast.success("Welcome back!"); setTimeout(() => navigate("/dashboard"), 1500); } catch (err) { toast.error("Sign in failed. Please check your credentials."); } }} className="space-y-4"> +
+ + setEmail(e.target.value)} + className="mt-1.5 bg-slate-800/50 border-slate-700 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:ring-indigo-500/20" + /> +
+
+
+ + Forgot password? +
+ setPassword(e.target.value)} + className="mt-1.5 bg-slate-800/50 border-slate-700 text-white placeholder:text-slate-500 focus:border-indigo-500 focus:ring-indigo-500/20" + /> +
+ + +
+ +
+ + or +
+ + + +

+ Don't have an account?{" "} + Sign up +

+
+
+
+
+ ); +}