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