'use client'; import { useState } from 'react'; import { useRouter, useSearchParams } from 'next/navigation'; import { signIn } from 'next-auth/react'; import Link from 'next/link'; export default function LoginPage() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const router = useRouter(); const searchParams = useSearchParams(); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setLoading(true); setError(''); const res = await signIn('credentials', { redirect: false, email, password, callbackUrl: searchParams.get('callbackUrl') || '/', }); setLoading(false); if (res?.error) { setError('Invalid email or password'); } else if (res?.ok) { router.push(res.url || '/'); } } async function handleGoogle() { setLoading(true); await signIn('google', { callbackUrl: searchParams.get('callbackUrl') || '/' }); setLoading(false); } return (
{/* Left side image or illustration */}
{/* You can replace this with your own image or illustration */} Login visual
{/* Right side form */}

Sign in to your account

Or{' '} Sign Up For Free

setEmail(e.target.value)} className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 dark:border-neutral-700 placeholder-gray-500 dark:placeholder-neutral-400 text-gray-900 dark:text-white bg-white dark:bg-neutral-800 rounded-t-md focus:outline-none focus:ring-primary-500 focus:border-primary-500 focus:z-10 sm:text-sm" placeholder="Email address" disabled={loading} />
setPassword(e.target.value)} className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 dark:border-neutral-700 placeholder-gray-500 dark:placeholder-neutral-400 text-gray-900 dark:text-white bg-white dark:bg-neutral-800 rounded-b-md focus:outline-none focus:ring-primary-500 focus:border-primary-500 focus:z-10 sm:text-sm" placeholder="Password" disabled={loading} />
{error && (
{error}
)}
Forgot your password?
{/* Social login buttons */}
Or continue with
); }