"use client"; import { useState } from "react"; import { useRouter } from "next/navigation"; import Image from "next/image"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Checkbox } from "@/components/ui/checkbox"; import { Eye, EyeOff, Loader2 } from "lucide-react"; import { toast } from "sonner"; export default function LoginPage() { const router = useRouter(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [showPassword, setShowPassword] = useState(false); const [rememberMe, setRememberMe] = useState(false); const [loading, setLoading] = useState(false); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); if (!email || !password) { toast.error("Please enter email and password"); return; } setLoading(true); try { const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, credentials: "include", body: JSON.stringify({ email, password }), }); const data = await res.json(); if (!res.ok) { toast.error(data.error || "Login failed"); return; } toast.success("Login successful"); window.location.href = "/"; } catch { toast.error("An error occurred"); } finally { setLoading(false); } } return (
{/* LINSE Title */}

LINSE

{/* Circuit Logo */}
Linse Symbol
{/* Login Form Card */}
{/* Email Input */} setEmail(e.target.value)} className="h-[50px] rounded-lg text-[15px]" style={{ background: "rgba(255, 255, 255, 0.05)", border: "1px solid rgba(255, 255, 255, 0.12)", color: "#d8e8f0" }} autoComplete="email" disabled={loading} /> {/* Password Input */}
setPassword(e.target.value)} className="h-[50px] rounded-lg text-[15px] pr-10" style={{ background: "rgba(255, 255, 255, 0.05)", border: "1px solid rgba(255, 255, 255, 0.12)", color: "#d8e8f0" }} autoComplete="current-password" disabled={loading} />
{/* Remember me & Forgot password */}
setRememberMe(checked as boolean)} className="border-[#9db4c1] data-[state=checked]:bg-cyan-600 data-[state=checked]:border-cyan-600" />
{/* Login Button */}
); }