import React, { useState } from "react"; import { Outlet, useLocation, useNavigate } from "react-router-dom"; import PasswordPopup from "./PasswordPopup"; const AdminLayout = () => { const location = useLocation(); const navigate = useNavigate(); const [showPopup, setShowPopup] = useState(false); const [popupFor, setPopupFor] = useState(""); const PASSWORDS = { Projects: "Lcepl@2026", // ← set your Projects password Gallery: "Lcepl#2026", // ← set your Gallery password }; const menuItems = [ { name: "Projects", path: "/admin/projects" }, { name: "Gallery", path: "/admin/gallery" }, { name: "HR", path: "/admin/hr" }, ]; // When user clicks menu const handleMenuClick = (item) => { if (item.name === "Projects" || item.name === "Gallery") { setPopupFor(item.name); setShowPopup(true); } else { navigate(item.path); } }; // Validate password const handlePasswordSubmit = (password) => { if (password === PASSWORDS[popupFor]) { setShowPopup(false); navigate(`/admin/${popupFor.toLowerCase()}`); } else { alert("❌ Incorrect password"); } }; const handleLogout = () => { sessionStorage.removeItem("admin"); navigate("/admin-login"); }; return (