// Sidebar.jsx — bodegas index, filtered by selected categoría const Sidebar = ({ bodegas, activeCategory, activeBodega, onPickBodega, counts, overlay, open, onClose }) => { // Filter bodegas by current category const visible = activeCategory === 'TODOS' ? bodegas : bodegas.filter((b) => b.categories.includes(activeCategory)); // Group "TODOS" by category for visual hierarchy const grouped = activeCategory === 'TODOS' ? [ ['Canarios', visible.filter((b) => b.categories.includes('CANARIOS'))], ['Nacionales', visible.filter((b) => b.categories.includes('NACIONALES') && !b.categories.includes('CANARIOS'))], ['Internacionales', visible.filter((b) => b.categories.includes('INTERNACIONALES') && !b.categories.includes('NACIONALES') && !b.categories.includes('CANARIOS'))]]. filter(([, list]) => list.length > 0) : [[null, visible]]; const totalForCat = counts[activeCategory] || 0; const allLabel = activeCategory === 'CANARIOS' ? 'Bodegas canarias' : activeCategory === 'NACIONALES' ? 'Bodegas nacionales' : activeCategory === 'INTERNACIONALES' ? 'Bodegas internacionales' : 'Todas las bodegas'; const asideEl = ( ); if (!overlay) return asideEl; return ( {open &&
} {asideEl} ); }; window.Sidebar = Sidebar;