import React, { useState } from "react"; import { X, Lock, RefreshCw, Mail, KeyRound } from "lucide-react"; import { loginAdmin } from "../lib/firebaseService"; interface AdminLoginModalProps { isOpen: boolean; onClose: () => void; onSuccess: () => void; darkMode: boolean; } export default function AdminLoginModal({ isOpen, onClose, onSuccess, darkMode }: AdminLoginModalProps) { const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [loading, setLoading] = useState(false); const [error, setError] = useState(""); if (!isOpen) return null; const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); if (!email || !password) { setError("Please fill in all fields."); return; } setLoading(true); setError(""); try { await loginAdmin(email, password); onSuccess(); onClose(); } catch (err: any) { setError(err.message || "Invalid authentication credentials."); } finally { setLoading(false); } }; return (

Staff Authentication

Direct database verification for Haider Brothers Traders admin

{error && (
{error}
)}
setEmail(e.target.value)} className={`w-full p-2.5 pl-9 rounded-xl text-xs border focus:outline-none focus:ring-2 focus:ring-brand-orange/40 focus:border-brand-orange ${ darkMode ? "bg-black/40 border-white/10 text-white" : "bg-slate-50 border-slate-200" }`} />
setPassword(e.target.value)} className={`w-full p-2.5 pl-9 rounded-xl text-xs border focus:outline-none focus:ring-2 focus:ring-brand-orange/40 focus:border-brand-orange ${ darkMode ? "bg-black/40 border-white/10 text-white" : "bg-slate-50 border-slate-200" }`} />
); }