fet: show avatar, user name and logout

This commit is contained in:
Rodolfo Ruiz
2025-08-04 21:20:14 -06:00
parent c3a3ea1d84
commit ff2dd6b095
2 changed files with 14 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import InventoryIcon from '@mui/icons-material/Inventory';
import LocalShippingIcon from '@mui/icons-material/LocalShipping';
import ExitToAppIcon from '@mui/icons-material/ExitToApp';
import AdminPanelSettingsIcon from '@mui/icons-material/AdminPanelSettings';
import { useAuth } from '../context/AuthContext';
import { useState } from 'react';
@@ -32,6 +33,8 @@ export default function MenuDrawer({ zone = 'public', open, onClose, onSelect })
const isMobile = useMediaQuery('(max-width:900px)');
const items = menuOptions[zone];
const { logout } = useAuth();
return (
<Drawer anchor="left" open={open} onClose={onClose} slotProps={{
paper: {
@@ -56,6 +59,12 @@ export default function MenuDrawer({ zone = 'public', open, onClose, onSelect })
<ListItem key={index} onClick={() => {
onClose(); // Close drawer
onSelect?.(text); // Notify parent of selected item
if (text === 'Logout') {
logout(); // cerrar sesión y redirigir
} else {
onSelect?.(text); // navegar al resto de vistas
}
}}>
<ListItemIcon sx={{ color: '#DFCCBCFF' }}>{icon}</ListItemIcon>