import React, { useState, useRef } from 'react'; import { useNavigate } from 'react-router-dom'; import { Menu, User, LogOut, Settings, Bell, Lock } from 'lucide-react'; import { format } from 'date-fns'; import { useAdminAuth } from '../../contexts'; import { useOnClickOutside } from '../../hooks/useOnClickOutside'; import { PasswordChangeModal } from './PasswordChangeModal'; interface AdminHeaderProps { onMenuClick: () => void; } export const AdminHeader: React.FC = ({ onMenuClick }) => { const navigate = useNavigate(); const { user, logout } = useAdminAuth(); const [showUserMenu, setShowUserMenu] = useState(false); const [showNotifications, setShowNotifications] = useState(false); const [showPasswordModal, setShowPasswordModal] = useState(false); const userMenuRef = useRef(null); const notificationRef = useRef(null); useOnClickOutside(userMenuRef, () => setShowUserMenu(false)); useOnClickOutside(notificationRef, () => setShowNotifications(false)); const handleLogout = () => { logout(); navigate('/admin/login'); }; // Mock notifications const notifications = [ { id: 1, type: 'warning', message: '3 events expiring in the next 7 days', time: new Date(), }, { id: 2, type: 'success', message: 'Wedding Smith-Jones archived successfully', time: new Date(Date.now() - 3600000), }, ]; return (
{/* Mobile menu button */} {/* Desktop breadcrumb or page title could go here */}

{format(new Date(), 'EEEE, MMMM d, yyyy')}

{/* Right side actions */}
{/* Notifications */}
{/* Notifications dropdown */} {showNotifications && (

Notifications

{notifications.map((notification) => (

{notification.message}

{format(notification.time, 'h:mm a')}

))}
)}
{/* User menu */}
{/* User dropdown */} {showUserMenu && (

{user?.username}

{user?.email}

)}
{/* Password Change Modal */} setShowPasswordModal(false)} />
); };