import { useState, useEffect } from 'react'; import { useNavigate } from 'react-router'; import { pb } from '~/lib/pocketbase'; import { Lock, Mail, Eye, EyeOff, Loader2, ArrowRight } from 'lucide-react'; export default function Login() { const navigate = useNavigate(); const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); // If already logged in, redirect to dashboard useEffect(() => { if (pb.authStore.isValid) { navigate('/', { replace: true }); } }, [navigate]); const handleLogin = async (e: React.FormEvent) => { e.preventDefault(); if (!email || !password) { setError('Please enter both email and password'); return; } setLoading(true); setError(''); try { await pb.collection('users').authWithPassword(email, password); navigate('/', { replace: true }); } catch (err: any) { setError(err?.message || 'Invalid email or password'); } finally { setLoading(false); } }; return (
{/* Background Decorative Orange Glow */}
{/* Logo & Header */}
{/* Logo styled exactly like the AR Viewer top-right logo */}
t.

AR Management

Authorized Access Only

{/* Login Card */}
{error && (
{error}
)} {/* Email Input */}
setEmail(e.target.value)} />
{/* Password Input */}
setPassword(e.target.value)} />
{/* Submit Button */}
SYSTEM IP MONITORED SECURE PORTAL
); }