From a7836f0c4b5fd55cb2974e7701b43daafabc47eb Mon Sep 17 00:00:00 2001 From: Dikshantpatil2077 Date: Fri, 9 Oct 2026 15:37:37 +0530 Subject: [PATCH] feat: enhance login page with improved error handling and UI updates --- app/routes/admin/login.tsx | 229 +++++++++++++++++++++++-------------- 1 file changed, 146 insertions(+), 83 deletions(-) diff --git a/app/routes/admin/login.tsx b/app/routes/admin/login.tsx index 34dc62f..acad791 100644 --- a/app/routes/admin/login.tsx +++ b/app/routes/admin/login.tsx @@ -2,12 +2,13 @@ import { useState, useEffect } from 'react'; import { useSubmit, useNavigation, useActionData, useNavigate, redirect } from 'react-router'; import type { Route } from './+types/login'; import { pb } from '~/lib/pocketbase'; -import { Lock, Mail, Eye, EyeOff, Loader2, ArrowRight } from 'lucide-react'; +`import { Lock, Mail, Eye, EyeOff, Loader2, ArrowRight, AlertCircle } from 'lucide-react'; import { Input } from '~/components/ui/input'; import { Button } from '~/components/ui/button'; import { Label } from '~/components/ui/label'; -import { Card } from '~/components/ui/card'; import { toast } from 'sonner'; +import { LogoMark } from '~/components/logo-mark'; +import { AuthBrandPanel } from '~/components/auth/auth-brand-panel'; export async function clientLoader() { if (pb.authStore.isValid) { @@ -33,6 +34,12 @@ export async function clientAction({ request }: Route.ClientActionArgs) { } } +const fieldLabel = 'normal-case tracking-normal text-sm font-medium text-neutral-300'; +const fieldIcon = + 'pointer-events-none absolute left-4 top-1/2 -translate-y-1/2 text-neutral-500 transition-colors group-focus-within:text-orange-500'; +const fieldInput = + 'h-12 rounded-xl border-neutral-800 bg-[#141414] pl-11 text-[15px] focus-visible:border-orange-500/70 focus-visible:ring-4 focus-visible:ring-orange-500/10'; + export default function Login() { const navigate = useNavigate(); const submit = useSubmit(); @@ -42,9 +49,11 @@ export default function Login() { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [showPassword, setShowPassword] = useState(false); + const [capsLock, setCapsLock] = useState(false); const [localError, setLocalError] = useState(''); const isLoading = navigation.state !== 'idle'; + const errorMessage = localError || actionData?.error; // Already-authenticated redirect fallback useEffect(() => { @@ -80,97 +89,151 @@ export default function Login() { submit(formData, { method: 'post' }); }; + const handleForgotPassword = () => { + toast.info('Please contact your administrator to reset your password.'); + }; + return ( -
-
+
+ -
-
-
- t. -
-

AR_Management

-

- Authorized Access Only -

-
+
+ {/* Subtle dot texture */} +
+
- -
- {(localError || actionData?.error) && ( -
- {localError || actionData?.error} -
- )} +
+
+ -
- -
- - - - setEmail(e.target.value)} - /> -
+
+

Welcome back

+

Sign in to your account to continue.

-
- -
- - - - setPassword(e.target.value)} - /> - +
+
+ + { + setPassword(e.target.value); + if (localError) setLocalError(''); + }} + onKeyUp={(e) => setCapsLock(e.getModifierState('CapsLock'))} + onBlur={() => setCapsLock(false)} + /> + +
+ {capsLock && ( +

+ + Caps Lock is on +

+ )} +
+ + -
+ {isLoading ? ( + <> + + Signing in… + + ) : ( + <> + Sign in + + + )} + +
- - - - -
- SYSTEM IP MONITORED SECURE PORTAL +

+ + Access is restricted to authorized team members. +

+
-
+ + +
); }