"use client"; import { BarChart3, Loader2, Shield, Zap } from "lucide-react"; import Image from "next/image"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { signIn } from "next-auth/react"; import { useId, useState } from "react"; import { toast } from "sonner"; import { Alert, AlertDescription } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { ThemeToggle } from "@/components/ui/theme-toggle"; export default function LoginPage() { const emailId = useId(); const emailHelpId = useId(); const passwordId = useId(); const passwordHelpId = useId(); const loadingStatusId = useId(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [error, setError] = useState(""); const [isLoading, setIsLoading] = useState(false); const router = useRouter(); async function handleLogin(e: React.FormEvent) { e.preventDefault(); setIsLoading(true); setError(""); try { const res = await signIn("credentials", { email, password, redirect: false, }); if (res?.ok) { toast.success("Login successful! Redirecting..."); router.push("/dashboard"); } else { setError("Invalid email or password. Please try again."); toast.error("Login failed. Please check your credentials."); } } catch { setError("An error occurred. Please try again."); toast.error("An unexpected error occurred."); } finally { setIsLoading(false); } } return (
{/* Left side - Branding and Features */}
LiveDash Logo
LiveDash

Welcome back to your analytics dashboard

Monitor, analyze, and optimize your customer conversations with AI-powered insights.

Real-time analytics and insights
Enterprise-grade security
AI-powered conversation analysis
{/* Right side - Login Form */}
{/* Mobile logo */}
LiveDash Logo
LiveDash
Sign in Enter your email and password to access your dashboard {/* Live region for screen reader announcements */}
{isLoading && "Signing in, please wait..."} {error && `Error: ${error}`}
{error && ( {error} )}
setEmail(e.target.value)} disabled={isLoading} required aria-describedby={emailHelpId} aria-invalid={!!error} className="transition-all duration-200 focus:ring-2 focus:ring-primary/20" />
Enter your company email address
setPassword(e.target.value)} disabled={isLoading} required aria-describedby={passwordHelpId} aria-invalid={!!error} className="transition-all duration-200 focus:ring-2 focus:ring-primary/20" />
Enter your account password
{isLoading && (
Authentication in progress, please wait
)}
Don't have a company account? Register here
Forgot your password?

By signing in, you agree to our{" "} Terms of Service {" "} and{" "} Privacy Policy

); }