import React, { useState } from 'react'; import { Lock, AlertCircle } from 'lucide-react'; interface AdminLoginProps { onLogin: (password: string) => void; darkMode: boolean; error?: string | null; } const AdminLogin: React.FC = ({ onLogin, darkMode, error }) => { const [password, setPassword] = useState(''); const [isLoading, setIsLoading] = useState(false); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); try { await onLogin(password); } catch (err: any) { // Error is now handled by the parent component } finally { setIsLoading(false); } }; return (

Admin Access Required

Please enter the admin password to access settings

setPassword(e.target.value)} placeholder="Enter admin password" className={`w-full px-4 py-2 rounded-md border ${ darkMode ? 'bg-gray-700 border-gray-600 text-white placeholder-gray-400' : 'bg-white border-gray-300 text-gray-900 placeholder-gray-500' } focus:outline-none focus:ring-2 focus:ring-blue-500`} disabled={isLoading} /> {error && (

{error}

)}
); }; export default AdminLogin;