fixes
This commit is contained in:
@@ -53,7 +53,7 @@ export default function AdminLayout({
|
|||||||
const [isCollapsed, setIsCollapsed] = React.useState(false);
|
const [isCollapsed, setIsCollapsed] = React.useState(false);
|
||||||
const [mobileOpen, setMobileOpen] = React.useState(false);
|
const [mobileOpen, setMobileOpen] = React.useState(false);
|
||||||
|
|
||||||
const activeResourceName = location.pathname.split('/')[1] || null;
|
const activeResourceName = location.pathname.split('/admin')[1] || null;
|
||||||
|
|
||||||
// AUTO-TOGGLE LOGIC
|
// AUTO-TOGGLE LOGIC
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
@@ -61,7 +61,7 @@ export default function AdminLayout({
|
|||||||
setIsCollapsed(false); // Mobile drawer is never "mini"
|
setIsCollapsed(false); // Mobile drawer is never "mini"
|
||||||
setMobileOpen(false); // Close on navigation
|
setMobileOpen(false); // Close on navigation
|
||||||
} else {
|
} else {
|
||||||
if (location.pathname === '/' || location.pathname === '') {
|
if (location.pathname === '/admin' || location.pathname === '') {
|
||||||
setIsCollapsed(false);
|
setIsCollapsed(false);
|
||||||
} else {
|
} else {
|
||||||
setIsCollapsed(true);
|
setIsCollapsed(true);
|
||||||
@@ -97,8 +97,8 @@ export default function AdminLayout({
|
|||||||
<ListItem disablePadding>
|
<ListItem disablePadding>
|
||||||
<Tooltip title={(isCollapsed && !isMobile) ? "Dashboard" : ""} placement="right">
|
<Tooltip title={(isCollapsed && !isMobile) ? "Dashboard" : ""} placement="right">
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
selected={location.pathname === '/'}
|
selected={location.pathname === '/admin'}
|
||||||
onClick={() => navigate('/')}
|
onClick={() => navigate('/admin')}
|
||||||
sx={{
|
sx={{
|
||||||
minHeight: 48,
|
minHeight: 48,
|
||||||
justifyContent: (isCollapsed && !isMobile) ? 'center' : 'initial',
|
justifyContent: (isCollapsed && !isMobile) ? 'center' : 'initial',
|
||||||
@@ -110,7 +110,7 @@ export default function AdminLayout({
|
|||||||
mr: (isCollapsed && !isMobile) ? 0 : 3,
|
mr: (isCollapsed && !isMobile) ? 0 : 3,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
}}>
|
}}>
|
||||||
<DashboardIcon color={location.pathname === '/' ? 'primary' : 'inherit'} />
|
<DashboardIcon color={location.pathname === '/admin' ? 'primary' : 'inherit'} />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
{(!isCollapsed || isMobile) && <ListItemText primary="Dashboard" />}
|
{(!isCollapsed || isMobile) && <ListItemText primary="Dashboard" />}
|
||||||
</ListItemButton>
|
</ListItemButton>
|
||||||
@@ -180,7 +180,7 @@ export default function AdminLayout({
|
|||||||
<Box sx={{ display: { xs: 'none', sm: 'flex' }, alignItems: 'center', mr: 2 }}>
|
<Box sx={{ display: { xs: 'none', sm: 'flex' }, alignItems: 'center', mr: 2 }}>
|
||||||
<Button
|
<Button
|
||||||
color="inherit"
|
color="inherit"
|
||||||
onClick={() => navigate('/profile')}
|
onClick={() => navigate('/admin/profile')}
|
||||||
sx={{ textTransform: 'none', fontWeight: 500 }}
|
sx={{ textTransform: 'none', fontWeight: 500 }}
|
||||||
>
|
>
|
||||||
{username}
|
{username}
|
||||||
|
|||||||
@@ -3,8 +3,14 @@ import { createRoot } from 'react-dom/client';
|
|||||||
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
||||||
import Home from './Home';
|
import Home from './Home';
|
||||||
import Admin from '../react-openapi/Admin';
|
import Admin from '../react-openapi/Admin';
|
||||||
|
import { Buffer } from 'buffer';
|
||||||
|
import process from 'process';
|
||||||
import { AuthProvider } from "../react-auth";
|
import { AuthProvider } from "../react-auth";
|
||||||
|
|
||||||
|
// Polyfill Node.js globals for browser environment (needed by SwaggerParser)
|
||||||
|
window.Buffer = Buffer;
|
||||||
|
window.process = process;
|
||||||
|
|
||||||
const rootElement = document.getElementById('root');
|
const rootElement = document.getElementById('root');
|
||||||
const root = createRoot(rootElement);
|
const root = createRoot(rootElement);
|
||||||
const AUTH_BASE = import.meta.env.VITE_AUTH_BASE_URL;
|
const AUTH_BASE = import.meta.env.VITE_AUTH_BASE_URL;
|
||||||
|
|||||||
Reference in New Issue
Block a user