'use client'; import { useState, useTransition } from 'react'; import { useTranslations } from 'next-intl'; import { useRouter } from 'next/navigation'; import { login } from '@/lib/auth-actions'; /** * Split-screen login page (D-01). * Left: Tessera branding with primary yellow (#ffed00) background. * Right: Login form on neutral background. * No sidebar or header (D-04, handled by (auth) layout). */ export default function LoginPage() { const t = useTranslations('auth'); const router = useRouter(); const [isPending, startTransition] = useTransition(); const [error, setError] = useState(null); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setError(null); const formData = new FormData(e.currentTarget); startTransition(async () => { const result = await login(formData); if (result.success) { router.push('/'); router.refresh(); } else { setError(result.error ?? 'invalidCredentials'); } }); } return (
{/* Left: Branding panel (hidden on mobile, visible on md+) */}
{/* Tessera logo / text */}

Tessera

{t('branding.tagline')}

{/* Abstract grid icon representing modules */}
{/* Right: Login form */}
{/* Mobile-only branding */}

Tessera

{t('branding.tagline')}

{/* Login heading */}

{t('login')}

{/* Error message */} {error && (
{t(`error.${error}`)}
)} {/* Login form */}
{/* Username */}
{/* Password */}
{/* Remember me (D-02) */}
{/* Submit button */}
); }