"use client" import { useState, useEffect, useRef } from "react" import { useRouter } from "next/navigation" import { motion } from "framer-motion" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Checkbox } from "@/components/ui/checkbox" import { COMPANY_NAME } from "@/lib/constants" import { Eye, EyeOff, Loader2 } from "lucide-react" function LoginForm() { const router = useRouter() const [email, setEmail] = useState("") const [password, setPassword] = useState("") const [showPassword, setShowPassword] = useState(false) const [loading, setLoading] = useState(false) const [remember, setRemember] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) try { const res = await fetch("/api/auth/login", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ email, password }), }) if (res.ok) { router.push("/dashboard") } else { const data = await res.json().catch(() => ({})) setError(data.error || "Invalid email or password.") } } catch { setError("Connection error. Please try again.") } finally { setLoading(false) } } return (
{COMPANY_NAME}

Your Agency's{" "} Growth{" "} Starts Here

Manage leads, track conversions, and grow your web development business with our CRM.

{counts.leads.toLocaleString()}
leads tracked
{counts.conversion}%
conversion lift
{counts.users}
active users

“{testimonials[testimonialIndex].text}”

{testimonials[testimonialIndex].author}

{testimonials.map((_, i) => (

Welcome back

Sign in to your account to continue

{error && (
{error}
)}
setEmail(e.target.value)} required autoComplete="email" className="login-input" />
setPassword(e.target.value)} required autoComplete="current-password" className="login-input" />

By signing in, you agree to our{" "} {" "} and{" "}

) }