All files / src/app/student-page/layout AppLayout.jsx

79% Statements 79/100
88.77% Branches 87/98
61.9% Functions 26/42
80.23% Lines 69/86

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634                                                                                                  2x 2x   2x               71x                                 1847x                                               111x   2x 57x         23x                                                       23x 23x 23x       23x   23x 1x                         22x                 22x                                                                                           25x     75x 75x                                             25x                           41x                                           25x                                                   52x   34x 34x 34x   34x 34x 34x 34x 34x   34x 34x 34x 34x 34x   34x 18x 18x 18x       34x 18x 18x       34x 19x       19x 19x     34x 4x 4x 4x 4x 4x                   34x         34x 34x 34x   36x   34x     34x     34x 2x                                                                                                                                                 2x                   6x                                       32x 2x                                                                                                                                                                                                   30x                                                                                           6x                  
import { useEffect, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { alpha, styled, useTheme } from "@mui/material/styles";
import { useDispatch, useSelector } from "react-redux";
import { useAuth0 } from "@auth0/auth0-react";
import { useSnackbar } from "notistack";
 
import {
    Avatar,
    Box,
    BottomNavigation,
    BottomNavigationAction,
    Button,
    Chip,
    Divider,
    Drawer,
    IconButton,
    List,
    ListItem,
    ListItemButton,
    ListItemIcon,
    ListItemText,
    Paper,
    Tooltip,
    Typography,
    useMediaQuery,
} from "@mui/material";
import AppBar from "@mui/material/AppBar";
import Toolbar from "@mui/material/Toolbar";
 
import DashboardIcon from "@mui/icons-material/Dashboard";
import SchoolIcon from "@mui/icons-material/School";
import SettingsIcon from "@mui/icons-material/Settings";
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import MenuIcon from "@mui/icons-material/Menu";
import LogoutIcon from "@mui/icons-material/Logout";
import CloseIcon from "@mui/icons-material/Close";
 
import { _userLogout } from "@/store/slices/auth/UserAuth";
import { logoutSession } from "@/authentication/session";
import YesNoOption from "@/utils/components/dialogs/YesNoOption";
import ViewProfile from "@/utils/components/dialogs/ViewProfile";
import PageError from "@/utils/components/page-error/PageError";
import LOGO from "@/assets/logo/mvp_logo.png";
import { formatProfileDisplayName } from "@/utils/helpers/organizationDisplay";
 
// ─── Constants ────────────────────────────────────────────────────────────────
 
const DRAWER_W = 260;
const RAIL_W = 64;
 
const NAV = [
    { label: "Dashboard", path: "/student", icon: <DashboardIcon />, exact: true },
    { label: "Classes", path: "/student/classes", icon: <SchoolIcon /> },
    { label: "Settings", path: "/student/settings", icon: <SettingsIcon /> },
];
 
// ─── Styled ────────────────────────────────────────────────────────────────────
 
const SidebarDrawer = styled(Drawer, { shouldForwardProp: (p) => p !== "expanded" })(({ theme, expanded }) => ({
    width: expanded ? DRAWER_W : RAIL_W,
    flexShrink: 0,
    "& .MuiDrawer-paper": {
        width: expanded ? DRAWER_W : RAIL_W,
        boxSizing: "border-box",
        borderRight: `1px solid ${theme.palette.divider}`,
        transition: theme.transitions.create("width", {
            easing: theme.transitions.easing.sharp,
            duration: expanded ? theme.transitions.duration.enteringScreen : theme.transitions.duration.leavingScreen,
        }),
        overflowX: "hidden",
        display: "flex",
        flexDirection: "column",
    },
}));
 
const NavBtn = styled(ListItemButton, { shouldForwardProp: (p) => p !== "active" })(({ theme, active }) => ({
    borderRadius: 10,
    marginInline: 8,
    marginBottom: 2,
    minHeight: 44,
    backgroundColor: active ? theme.palette.primary.main : "transparent",
    color: active ? "#fff" : theme.palette.text.primary,
    "&:hover": {
        backgroundColor: active ? theme.palette.primary.dark : alpha(theme.palette.primary.main, 0.07),
    },
    transition: "background-color 0.15s ease",
    "& .MuiListItemIcon-root": {
        color: active ? "#fff" : theme.palette.text.secondary,
        minWidth: 0,
        transition: "margin 0.2s ease",
    },
    "& .MuiListItemText-primary": {
        fontWeight: active ? 600 : 400,
        fontSize: "0.875rem",
    },
}));
 
// ─── Helpers ──────────────────────────────────────────────────────────────────
 
const isNavActive = (item, pathname) => (item.exact ? pathname === item.path : pathname.startsWith(item.path));
 
const getInitials = (data) =>
    `${data?.first_name?.[0]?.toUpperCase() ?? ""}${data?.last_name?.[0]?.toUpperCase() ?? ""}`;
 
// ─── Sub-components ────────────────────────────────────────────────────────────
 
function Brand({ expanded }) {
    return (
        <Box
            sx={{
                display: "flex",
                alignItems: "center",
                justifyContent: expanded ? "flex-start" : "center",
                gap: 1,
                px: expanded ? 2 : 0,
                py: 1.5,
                overflow: "hidden",
            }}
        >
            {expanded && <img src={LOGO} alt="logo" style={{ width: 32, height: 32, flexShrink: 0 }} />}
            {expanded && (
                <Typography
                    variant="subtitle2"
                    color="primary"
                    noWrap
                    sx={{ fontWeight: 800, letterSpacing: "0.18em", fontSize: "0.78rem" }}
                >
                    EruditionTX
                </Typography>
            )}
        </Box>
    );
}
 
function ProfileCard({ data, photoUrl, expanded, onViewProfile }) {
    const src = photoUrl || data?.profile_picture;
    const initials = getInitials(data);
    const displayName = formatProfileDisplayName(`${data?.first_name ?? ""} ${data?.last_name ?? ""}`.trim());
    // Normalize regardless of source casing ("STUDENT" / "student" / "Student" all -> "Student") —
    // formatProfileDisplayName only rewrites strings that are entirely uppercase, which isn't
    // what a single role word needs here.
    const roleLabel = data?.role ? data.role.charAt(0).toUpperCase() + data.role.slice(1).toLowerCase() : "";
 
    if (!expanded) {
        return (
            <Tooltip title="View Profile" placement="right">
                <Box sx={{ display: "flex", justifyContent: "center", py: 1.5 }}>
                    <IconButton onClick={onViewProfile} sx={{ p: 0 }} id="student-sidebar-item-view-profile">
                        <Avatar src={src} sx={{ width: 38, height: 38, bgcolor: "primary.main", fontSize: "0.85rem" }}>
                            {!src && initials}
                        </Avatar>
                    </IconButton>
                </Box>
            </Tooltip>
        );
    }
 
    return (
        <Box sx={{ px: 2, py: 2, display: "flex", flexDirection: "column", alignItems: "center", gap: 1 }}>
            <Avatar
                src={src}
                sx={{
                    width: 68,
                    height: 68,
                    bgcolor: "primary.main",
                    fontSize: "1.3rem",
                    boxShadow: (t) => `0 0 0 3px ${alpha(t.palette.primary.main, 0.2)}`,
                }}
            >
                {!src && initials}
            </Avatar>
            <Box sx={{ textAlign: "center", width: "100%" }}>
                <Typography fontWeight={700} noWrap sx={{ fontSize: "0.85rem" }}>
                    {displayName}
                </Typography>
                <Typography
                    id="student-sidebar-account-email"
                    variant="caption"
                    color="text.secondary"
                    noWrap
                    sx={{ display: "block", fontSize: "0.7rem" }}
                >
                    {data?.email}
                </Typography>
                <Chip
                    label={roleLabel}
                    size="small"
                    sx={{
                        mt: 0.75,
                        bgcolor: "primary.main",
                        color: "#fff",
                        fontWeight: 600,
                        fontSize: "0.65rem",
                        height: 18,
                    }}
                />
            </Box>
            <Button
                id="student-sidebar-button-view-profile"
                variant="outlined"
                size="small"
                fullWidth
                onClick={onViewProfile}
                sx={{ mt: 0.5, textTransform: "none", fontWeight: 500, fontSize: "0.75rem", borderRadius: 2 }}
            >
                View Profile
            </Button>
        </Box>
    );
}
 
function NavList({ expanded, pathname, onNavigate }) {
    return (
        <List sx={{ p: 0 }}>
            {NAV.map((item) => {
                const active = isNavActive(item, pathname);
                return (
                    <ListItem key={item.label} disablePadding>
                        <Tooltip title={expanded ? "" : item.label} placement="right">
                            <NavBtn
                                id={`student-sidebar-button-${item.label}`}
                                active={active ? 1 : 0}
                                onClick={() => onNavigate(item.path)}
                                sx={{ justifyContent: expanded ? "flex-start" : "center" }}
                            >
                                <ListItemIcon sx={{ mr: expanded ? 1.5 : 0, justifyContent: "center" }}>
                                    {item.icon}
                                </ListItemIcon>
                                {expanded && <ListItemText primary={item.label} />}
                            </NavBtn>
                        </Tooltip>
                    </ListItem>
                );
            })}
        </List>
    );
}
 
function LogoutBtn({ expanded, onLogout }) {
    return (
        <List sx={{ p: 0 }}>
            <ListItem disablePadding>
                <Tooltip title={expanded ? "" : "Logout"} placement="right">
                    <ListItemButton
                        id="student-sidebar-button-Logout"
                        onClick={onLogout}
                        sx={{
                            borderRadius: 2,
                            mx: 1,
                            mb: 1,
                            minHeight: 44,
                            justifyContent: expanded ? "flex-start" : "center",
                            color: "error.main",
                            "&:hover": { bgcolor: (t) => alpha(t.palette.error.main, 0.08) },
                        }}
                    >
                        <ListItemIcon
                            sx={{ minWidth: 0, mr: expanded ? 1.5 : 0, justifyContent: "center", color: "error.main" }}
                        >
                            <LogoutIcon fontSize="small" />
                        </ListItemIcon>
                        {expanded && (
                            <ListItemText
                                primary="Logout"
                                primaryTypographyProps={{ fontWeight: 500, fontSize: "0.875rem", color: "error.main" }}
                            />
                        )}
                    </ListItemButton>
                </Tooltip>
            </ListItem>
        </List>
    );
}
 
function DrawerInner({ studentData, photoUrl, expanded, pathname, onNavigate, onViewProfile, onLogout }) {
    return (
        <>
            <Box sx={{ flex: 1, overflowY: "auto", overflowX: "hidden" }}>
                {studentData && (
                    <>
                        <ProfileCard
                            data={studentData}
                            photoUrl={photoUrl}
                            expanded={expanded}
                            onViewProfile={onViewProfile}
                        />
                        <Divider sx={{ mx: expanded ? 2 : 1 }} />
                        <Box sx={{ mt: 1 }} />
                    </>
                )}
                <NavList expanded={expanded} pathname={pathname} onNavigate={onNavigate} />
            </Box>
            <Divider />
            <LogoutBtn expanded={expanded} onLogout={onLogout} />
        </>
    );
}
 
// ─── Main component ────────────────────────────────────────────────────────────
 
export default function AppLayout({ children }) {
    const { studentData } = useSelector((state) => state.StudentData);
 
    const theme = useTheme();
    const isMobile = useMediaQuery("(max-width:450px)");
    const isTablet = useMediaQuery("(min-width:451px) and (max-width:1020px)");
 
    const navigate = useNavigate();
    const location = useLocation();
    const dispatch = useDispatch();
    const { enqueueSnackbar, closeSnackbar } = useSnackbar();
    const { logout } = useAuth0();
 
    const [desktopExpanded, setDesktopExpanded] = useState(true);
    const [tabletOpen, setTabletOpen] = useState(false);
    const [logoutDialog, setLogoutDialog] = useState(false);
    const [profileDialog, setProfileDialog] = useState(false);
    const [localPhoto, setLocalPhoto] = useState(null);
 
    useEffect(() => {
        const handler = (e) => setLocalPhoto(e.detail);
        window.addEventListener("profilePhotoUpdated", handler);
        return () => window.removeEventListener("profilePhotoUpdated", handler);
    }, []);
 
    // Auto-expand on top-level routes, collapse on nested pages
    useEffect(() => {
        const topLevel = ["/student", "/student/classes", "/student/settings"];
        if (!isMobile && !isTablet) setDesktopExpanded(topLevel.includes(location.pathname));
    }, [location.pathname, isMobile, isTablet]);
 
    // Sync CSS var so page content can offset itself; collapse fully when taking an assignment
    useEffect(() => {
        Iif (location.pathname.includes("/answer")) {
            document.documentElement.style.setProperty("--sidebar-width", "0px");
            return;
        }
        const w = isMobile || isTablet ? "0px" : desktopExpanded ? `${DRAWER_W}px` : `${RAIL_W}px`;
        document.documentElement.style.setProperty("--sidebar-width", w);
    }, [desktopExpanded, isMobile, isTablet, location.pathname]);
 
    const handleLogout = () => {
        logoutSession();
        dispatch(_userLogout());
        logout({ openUrl: false });
        navigate("/");
        enqueueSnackbar("Successfully logged out", {
            variant: "success",
            action: (key) => (
                <IconButton size="small" color="inherit" onClick={() => closeSnackbar(key)}>
                    <CloseIcon fontSize="small" />
                </IconButton>
            ),
        });
    };
 
    const handleNav = (path) => {
        navigate(path);
        setTabletOpen(false);
    };
 
    const photoSrc = localPhoto || studentData?.profile_picture;
    const initials = getInitials(studentData);
    const pathname = location.pathname;
 
    const bottomNavValue = NAV.findIndex((item) => isNavActive(item, pathname));
 
    const content = studentData ? children : <PageError />;
 
    // Strip all chrome when taking an assignment
    Iif (pathname.includes("/answer")) return <Box sx={{ width: "100%" }}>{content}</Box>;
 
    // ── MOBILE ────────────────────────────────────────────────
    if (isMobile) {
        return (
            <>
                <YesNoOption
                    id="student-logout-dialog"
                    title="Confirm Logout"
                    message="Do you want to logout?"
                    showDialog={logoutDialog}
                    clickNo={setLogoutDialog}
                    clickYes={handleLogout}
                />
                <ViewProfile open={profileDialog} setShowProfile={setProfileDialog} userData={studentData} />
 
                <AppBar
                    position="fixed"
                    elevation={0}
                    sx={{
                        bgcolor: "primary.main",
                        zIndex: theme.zIndex.appBar,
                        borderBottom: "1px solid rgba(255,255,255,0.12)",
                    }}
                >
                    <Toolbar sx={{ minHeight: "56px !important", px: 2, justifyContent: "space-between" }}>
                        <Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
                            <img src={LOGO} alt="logo" style={{ width: 28 }} />
                            <Typography
                                variant="subtitle2"
                                sx={{ fontWeight: 800, letterSpacing: "0.15em", color: "#fff" }}
                            >
                                EruditionTX
                            </Typography>
                        </Box>
                        <Box sx={{ display: "flex", gap: 0.5 }}>
                            <IconButton
                                id="student-sidebar-item-view-profile"
                                size="small"
                                onClick={() => setProfileDialog(true)}
                                sx={{ p: 0.25 }}
                            >
                                <Avatar
                                    src={photoSrc}
                                    sx={{
                                        width: 30,
                                        height: 30,
                                        bgcolor: "rgba(255,255,255,0.2)",
                                        fontSize: "0.75rem",
                                        border: "2px solid rgba(255,255,255,0.4)",
                                    }}
                                >
                                    {!photoSrc && initials}
                                </Avatar>
                            </IconButton>
                            <IconButton
                                id="student-sidebar-button-Logout"
                                size="small"
                                color="inherit"
                                onClick={() => setLogoutDialog(true)}
                            >
                                <LogoutIcon sx={{ fontSize: 18 }} />
                            </IconButton>
                        </Box>
                    </Toolbar>
                </AppBar>
 
                <Box sx={{ mt: "56px", pb: "56px", minHeight: "100vh" }}>{content}</Box>
 
                <Paper
                    elevation={4}
                    sx={{
                        position: "fixed",
                        bottom: 0,
                        left: 0,
                        right: 0,
                        zIndex: theme.zIndex.appBar,
                        borderTop: (t) => `1px solid ${t.palette.divider}`,
                    }}
                >
                    <BottomNavigation
                        value={bottomNavValue >= 0 ? bottomNavValue : false}
                        onChange={(_, idx) => handleNav(NAV[idx].path)}
                        showLabels
                        sx={{ height: 56 }}
                    >
                        {NAV.map((item) => (
                            <BottomNavigationAction
                                key={item.label}
                                id={`student-sidebar-button-${item.label}`}
                                label={item.label}
                                icon={item.icon}
                                sx={{
                                    minWidth: 0,
                                    "&.Mui-selected": { color: "primary.main" },
                                    "& .MuiBottomNavigationAction-label": { fontSize: "0.58rem" },
                                    "& .MuiBottomNavigationAction-label.Mui-selected": { fontSize: "0.58rem" },
                                }}
                            />
                        ))}
                    </BottomNavigation>
                </Paper>
            </>
        );
    }
 
    // ── TABLET ────────────────────────────────────────────────
    if (isTablet) {
        return (
            <>
                <YesNoOption
                    id="student-logout-dialog"
                    title="Confirm Logout"
                    message="Do you want to logout?"
                    showDialog={logoutDialog}
                    clickNo={setLogoutDialog}
                    clickYes={handleLogout}
                />
                <ViewProfile open={profileDialog} setShowProfile={setProfileDialog} userData={studentData} />
 
                <AppBar
                    position="fixed"
                    elevation={0}
                    sx={{
                        bgcolor: "primary.main",
                        zIndex: theme.zIndex.drawer + 1,
                        borderBottom: "1px solid rgba(255,255,255,0.12)",
                    }}
                >
                    <Toolbar sx={{ gap: 1 }}>
                        <IconButton
                            id="student-sidebar-tablet-menu"
                            color="inherit"
                            edge="start"
                            onClick={() => setTabletOpen((v) => !v)}
                        >
                            <MenuIcon />
                        </IconButton>
                        <img src={LOGO} alt="logo" style={{ width: 30 }} />
                        <Typography
                            variant="subtitle2"
                            sx={{ fontWeight: 800, letterSpacing: "0.15em", color: "#fff", flex: 1 }}
                        >
                            EruditionTX
                        </Typography>
                        <IconButton
                            id="student-sidebar-item-view-profile"
                            size="small"
                            onClick={() => setProfileDialog(true)}
                            sx={{ p: 0.25 }}
                        >
                            <Avatar
                                src={photoSrc}
                                sx={{
                                    width: 34,
                                    height: 34,
                                    bgcolor: "rgba(255,255,255,0.2)",
                                    fontSize: "0.85rem",
                                    border: "2px solid rgba(255,255,255,0.4)",
                                }}
                            >
                                {!photoSrc && initials}
                            </Avatar>
                        </IconButton>
                    </Toolbar>
                </AppBar>
 
                <Drawer
                    variant="temporary"
                    open={tabletOpen}
                    onClose={() => setTabletOpen(false)}
                    ModalProps={{ keepMounted: true }}
                    sx={{ "& .MuiDrawer-paper": { width: DRAWER_W, display: "flex", flexDirection: "column" } }}
                >
                    <Toolbar />
                    <Box sx={{ px: 2, py: 1.5, display: "flex", alignItems: "center", gap: 1 }}>
                        <img src={LOGO} alt="logo" style={{ width: 28 }} />
                        <Typography
                            variant="subtitle2"
                            color="primary"
                            sx={{ fontWeight: 800, letterSpacing: "0.18em", fontSize: "0.78rem" }}
                        >
                            EruditionTX
                        </Typography>
                    </Box>
                    <Divider />
                    <DrawerInner
                        studentData={studentData}
                        photoUrl={photoSrc}
                        expanded
                        pathname={pathname}
                        onNavigate={handleNav}
                        onViewProfile={() => {
                            setProfileDialog(true);
                            setTabletOpen(false);
                        }}
                        onLogout={() => setLogoutDialog(true)}
                    />
                </Drawer>
 
                <Box sx={{ mt: "64px", width: "100%" }}>{content}</Box>
            </>
        );
    }
 
    // ── DESKTOP ───────────────────────────────────────────────
    return (
        <>
            <YesNoOption
                id="student-logout-dialog"
                title="Confirm Logout"
                message="Do you want to logout?"
                showDialog={logoutDialog}
                clickNo={setLogoutDialog}
                clickYes={handleLogout}
            />
            <ViewProfile open={profileDialog} setShowProfile={setProfileDialog} userData={studentData} />
 
            <Box sx={{ display: "flex", minHeight: "100vh" }}>
                <SidebarDrawer variant="permanent" expanded={desktopExpanded ? 1 : 0}>
                    <Box
                        sx={{
                            display: "flex",
                            alignItems: "center",
                            justifyContent: "space-between",
                            minHeight: 56,
                            px: 1,
                            flexShrink: 0,
                        }}
                    >
                        <Brand expanded={desktopExpanded} />
                        <IconButton
                            id="student-sidedrawer-button-hide"
                            size="small"
                            onClick={() => setDesktopExpanded((v) => !v)}
                            sx={{ flexShrink: 0 }}
                        >
                            {desktopExpanded ? (
                                <ChevronLeftIcon fontSize="small" />
                            ) : (
                                <ChevronRightIcon fontSize="small" />
                            )}
                        </IconButton>
                    </Box>
                    <Divider />
                    <DrawerInner
                        studentData={studentData}
                        photoUrl={photoSrc}
                        expanded={desktopExpanded}
                        pathname={pathname}
                        onNavigate={handleNav}
                        onViewProfile={() => setProfileDialog(true)}
                        onLogout={() => setLogoutDialog(true)}
                    />
                </SidebarDrawer>
 
                <Box sx={{ flex: 1, minWidth: 0, display: "flex", flexDirection: "column" }}>{content}</Box>
            </Box>
        </>
    );
}