'use client'; import { useState, useEffect } from 'react'; import { useRouter } from 'next/navigation'; import { useAuthStore } from '@/lib/auth-store'; import { useTheme } from '@/lib/theme-store'; import { Eye, EyeOff, Sun, Moon, ArrowRight, Loader2, TicketCheck, Users, TrendingUp, ShieldCheck, } from 'lucide-react'; const EDR_GREEN = 'rgb(20, 113, 76)'; const features = [ { icon: TicketCheck, label: 'Booking Management', desc: 'Full lifecycle booking operations' }, { icon: Users, label: 'Passenger Services', desc: 'Profiles, loyalty & wallet' }, { icon: TrendingUp, label: 'Revenue Analytics', desc: 'Real-time reports & insights' }, { icon: ShieldCheck, label: 'Fraud Detection', desc: 'Automated risk monitoring' }, ]; export default function LoginPage() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const [showPassword, setShowPassword] = useState(false); const [isMounted, setIsMounted] = useState(false); const [emailFocused, setEmailFocused] = useState(false); const [passwordFocused, setPasswordFocused] = useState(false); const router = useRouter(); const { login } = useAuthStore(); const { isDark, toggleTheme } = useTheme(); useEffect(() => { setIsMounted(true); }, []); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); try { await login(email, password); router.push('/dashboard'); } catch (err: any) { setError(err.response?.data?.message || err.message || 'Invalid credentials. Please try again.'); } finally { setLoading(false); } }; if (!isMounted) return null; return (
Enter your credentials to access the back-office.
{error}
Access is restricted to authorised EDR staff only. All sessions are logged and audited.
Unified platform for booking operations, passenger services, revenue analytics, and real-time train management.