// Layout.jsx
// import React, { useState } from "react";
// import { Outlet, NavLink, useLocation } from "react-router-dom";
// import { useNavigate } from 'react-router-dom';
// import { FaBell, FaCog } from "react-icons/fa";
// import "../styles/Dashboard.css";
// const menuConfig = [
// {
// label: "Dashboards",
// basePath: "/app/income",
// submenu: [
// { label: "Income", route: "/app/income" },
// { label: "Expenses", route: "/app/expenses" },
// { label: "Cost per room", route: "/app/cost-per-room" },
// { label: "Budget", route: "/app/budget" },
// ],
// },
// {
// label: "Expenses to be approved",
// basePath: "/app/pending-approval",
// submenu: [
// { label: "Pending approval", route: "/app/pending-approval" },
// { label: "Approved", route: "/app/approved" },
// { label: "Rejected", route: "/app/rejected" },
// ],
// },
// {
// label: "Expenses",
// basePath: "/app/report",
// submenu: [
// { label: "Report", route: "/app/report" },
// { label: "New Expense", route: "/app/new-expense" },
// { label: "Payments", route: "/app/payments" },
// { label: "Monthly Payments", route: "/app/monthly-payments" },
// { label: "Id", route: "/app/expense-id" },
// ],
// },
// {
// label: "Inventory",
// basePath: "/app/products",
// submenu: [
// { label: "Products", route: "/app/products" },
// { label: "New Product", route: "/app/new-product" },
// { label: "Report", route: "/app/inventory-report" },
// ],
// },
// {
// label: "Payroll",
// basePath: "/app/payroll",
// submenu: [
// { label: "Report", route: "/app/payroll" },
// ],
// },
// {
// label: "Hotel",
// basePath: "/app/properties",
// submenu: [
// { label: "Properties", route: "/app/properties" },
// // { label: "New Property", route: "/app/properties/:id"},
// ],
// },
// ];
// export default function Layout() {
// const navigate = useNavigate();
// const location = useLocation();
// const [isSidebarOpen, setSidebarOpen] = useState(true);
// const toggleSidebar = () => setSidebarOpen(!isSidebarOpen);
// const isDetailPage = /^\/app\/properties\/\d+$/.test(location.pathname);
// const isSettingsPage = location.pathname === "/app/settings";
// // Detectar qué menú está activo según la ruta actual
// // const activeSection = menuConfig.find(section =>
// // location.pathname.startsWith(section.basePath)
// // );
// // const activeSection = menuConfig.find(section =>
// // section.submenu.some(item => location.pathname.startsWith(item.route))
// // );
// // Encuentra la sección activa o ignórala si es una ruta especial como "/app/properties/:id"
// const activeSection = menuConfig.find(section =>
// section.submenu.some(item => location.pathname.startsWith(item.route))
// );
// // Si no hay sección activa, es una página sin menú (como detalles)
// const activeSubmenu = activeSection?.submenu || [];
// return (
//
// {/* Sidebar */}
// {isSidebarOpen && (
//
// )}
// {/* Main content */}
//
// {/* Topbar */}
//
//
// {/* Oculta título si estamos en /app/settings */}
// {!isSettingsPage && (
//
{activeSection?.label}
// )}
//
//
// navigate("/app/settings")}
// />
//
//
// {/*Oculta submenú si es página de detalles o settings */}
// {!isDetailPage && !isSettingsPage && (
//
// {activeSubmenu.map((item, index) => (
//
// isActive ? "submenu-link active" : "submenu-link"
// }
// >
// {item.label}
//
// ))}
//
// )}
//
// {/* Página actual */}
//
//
//
//
//
// );
// return (
//
// {/* Sidebar */}
// {isSidebarOpen && (
//
// )}
// {/* Contenido principal */}
//
// {/* ÚNICO Topbar */}
//
// {/* Línea superior: título + iconos */}
//
//
{activeSection?.label}
//
//
// navigate("/app/settings")} />
//
//
// {/* Línea inferior: submenú dinámico */}
// {/* Línea inferior: submenú dinámico */}
// {!isDetailPage && (
//
// {activeSubmenu.map((item, index) => (
//
// isActive ? "submenu-link active" : "submenu-link"
// }
// >
// {item.label}
//
// ))}
//
// )}
// {/*
// {activeSubmenu.map((item, index) => (
//
// isActive ? "submenu-link active" : "submenu-link"
// }
// >
// {item.label}
//
// ))}
//
*/}
//
// {/* Aquí va el contenido de la página */}
//
//
//
//
//
// );
//}
//{ label: "Property", route: "/app/properties/:id" },
// import React from "react";
// import { Outlet, useLocation, NavLink } from "react-router-dom";
// import { menuConfig } from "../constants/menuConfig";
// import { FaBell, FaCog } from "react-icons/fa";
// import "../styles/Dashboard.css";
// export default function Layout() {
// const location = useLocation();
// const pathname = location.pathname;
// // Encuentra la sección activa
// const activeSectionKey = Object.keys(menuConfig).find((key) =>
// pathname.startsWith(menuConfig[key].baseRoute)
// );
// const activeSection = menuConfig[activeSectionKey];
// const activeSubmenu = activeSection?.submenu || [];
// return (
//
// {/* SIDEBAR */}
//
// {/* CONTENIDO PRINCIPAL */}
//
// {/* TOPBAR */}
//
//
//
{activeSection?.label}
//
//
//
//
//
//
// {activeSubmenu.map((item, index) => (
//
// isActive ? "submenu-link active" : "submenu-link"
// }
// >
// {item.label}
//
// ))}
//
//
// {/* CONTENIDO */}
//
//
//
//
//
// );
// }
// // src/components/Layout.jsx
// import React, { useState } from "react";
// import { Outlet, NavLink } from "react-router-dom";
// import "../styles/Dashboard.css";
// export default function Layout() {
// const [isSidebarOpen, setSidebarOpen] = useState(true);
// const toggleSidebar = () => {
// setSidebarOpen(!isSidebarOpen);
// };
// return (
//
// {/* Sidebar */}
// {isSidebarOpen && (
//
// )}
// {/* Contenedor principal */}
//
// {/* Topbar */}
//
//
// Dashboard {/* Cambia esto dinámicamente si deseas */}
//
// {/* Contenido de cada página */}
//
//
//
//
//
// );
// }
// Users