diff --git a/src/App.jsx b/src/App.jsx
index a3136bc..7e061df 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -1,65 +1,84 @@
-import { useState } from 'react'
-import './App.css'
+import { useState } from 'react';
+import { Box, useMediaQuery } from '@mui/material';
+import { useTheme } from '@mui/material/styles';
import AppHeader from './components/AppHeader';
+import MenuDrawerPrivate, { OPEN_WIDTH, MINI_WIDTH } from './components/MenuDrawerPrivate';
import Footer from './components/Footer';
-import Box from '@mui/material/Box';
-
-import Clients from './private/clients/Clients';
import Dashboard from './private/dashboard/Dashboard';
import UserManagement from './private/users/UserManagement';
-
import LoginPage from './private/LoginPage';
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom';
+
import { useAuth } from './context/AuthContext';
+const DRAWER_EXPANDED = OPEN_WIDTH;
+const DRAWER_COLLAPSED = MINI_WIDTH;
+const APPBAR_HEIGHT = 64;
+
function PrivateRoute({ children }) {
const { user } = useAuth();
return user ? children : ;
}
-function App() {
+export default function App() {
+ const theme = useTheme();
+ const isMobile = useMediaQuery('(max-width:900px)');
const [zone, setZone] = useState('public'); // public | restricted | private
+
+ const [drawerExpanded, setDrawerExpanded] = useState(true);
const [currentView, setCurrentView] = useState('Dashboard');
+ const mainLeft = isMobile ? 0 : (drawerExpanded ? DRAWER_EXPANDED : DRAWER_COLLAPSED);
+
return (
<>
+
+
+ {
+ setCurrentView(value === '/users/UserManagement' ? 'UserManagement' : value);
+ }}
+ onExpandedChange={(expanded) => setDrawerExpanded(expanded)}
+ />
+
+
+ } />
- setCurrentView(view)} />
-
+
+ {zone === 'private' && }
+ {zone === 'restricted' && }
-
-
- } />
+ {zone === 'public' && currentView === 'Dashboard' && }
-
- {zone === 'private' && }
- {zone === 'restricted' && }
-
- {zone === 'public' && currentView === 'Dashboard' && }
-
- {zone === 'public' && currentView === 'UserManagement' && }
-
- }
- />
-
-
-
-
-
+ {zone === 'public' && currentView === 'UserManagement' && }
+
+ }
+ />
+
- >
- )
-}
+
+
-export default App
+ >
+ );
+}
\ No newline at end of file
diff --git a/src/components/AppHeader.jsx b/src/components/AppHeader.jsx
index 6c27a25..573c019 100644
--- a/src/components/AppHeader.jsx
+++ b/src/components/AppHeader.jsx
@@ -1,64 +1,45 @@
-import { useState } from 'react';
-import { AppBar, Toolbar, Typography, IconButton, Box, Avatar } from '@mui/material';
-
-import MenuDrawer from './MenuDrawer';
-import MenuDrawerPrivate from './MenuDrawerPrivate';
import { useAuth } from '../context/AuthContext';
-import { useNavigate } from 'react-router-dom';
+import { AppBar, Toolbar, Typography, IconButton, Box, Avatar, useMediaQuery } from '@mui/material';
+import { useTheme } from '@mui/material/styles';
+import { OPEN_WIDTH, MINI_WIDTH } from './MenuDrawerPrivate';
-export default function AppHeader({ zone = 'public', onSelectMenuItem }) {
- const bgColor = {
- public: 'white',
- restricted: 'white',
- private: 'white',
- };
-
- const [drawerExpanded, setDrawerExpanded] = useState(true);
- const [currentPage, setCurrentPage] = useState('Dashboard');
+export default function AppHeader({ drawerExpanded = true, currentPage = 'Dashboard' }) {
+ const theme = useTheme();
+ const isMobile = useMediaQuery('(max-width:900px)');
const { user } = useAuth();
- const isPrivate = zone === 'private';
- const isRestricted = zone === 'restricted';
- const isPublic = zone === 'public';
- const navigate = useNavigate();
-
- const handleMenuSelect = (page) => {
- setCurrentPage(page);
- onSelectMenuItem?.(page);
- };
+ const leftOffset = isMobile ? 0 : (drawerExpanded ? OPEN_WIDTH : MINI_WIDTH);
return (
-
-
+ }}
+ >
+
-
+
{currentPage}
-
- setDrawerExpanded(expanded)}
- />
-
);
diff --git a/src/components/MenuDrawerPrivate.jsx b/src/components/MenuDrawerPrivate.jsx
index 9256c63..58c10d6 100644
--- a/src/components/MenuDrawerPrivate.jsx
+++ b/src/components/MenuDrawerPrivate.jsx
@@ -14,8 +14,8 @@ import SettingsIcon from '@mui/icons-material/Settings';
import ExpandLess from '@mui/icons-material/ExpandLess';
import ExpandMore from '@mui/icons-material/ExpandMore';
-const OPEN_WIDTH = 400;
-const MINI_WIDTH = 72;
+export const OPEN_WIDTH = 450;
+export const MINI_WIDTH = 72;
const menuData = [
{
@@ -37,13 +37,15 @@ const menuData = [
{
title: 'Category Dictionary',
children: [
- { title: 'Categories' },
- { title: 'Products' },
- { title: 'All Assets Library' },
- { title: 'Media Management' },
- { title: 'Product Collections' },
+ { title: 'Categories' }
]
- }
+ },
+ { title: 'Products',
+ children: [
+ { title: 'AR Assets Library Management' },
+ { title: 'Media Management' },
+ ] },
+ { title: 'Product Collections' },
]
}
]
@@ -52,13 +54,17 @@ const menuData = [
title: 'Customers',
icon: ,
children: [
- { title: 'CRM' },
- { title: 'Customer List' },
- {
- title: 'Projects',
+ { title: 'CRM',
children: [
+ { title: 'Customer List' },
+ { title: 'Projects' },
{ title: 'Customer Collections' },
- { title: 'Sales' },
+ ]
+ },
+
+ {
+ title: 'Sales',
+ children: [
{ title: 'Quotes' },
{ title: 'Orders' },
]
@@ -80,9 +86,12 @@ const menuData = [
icon: ,
children: [
{ title: 'Users Management' },
- { title: 'Access Control' },
- { title: 'Roles' },
- { title: 'Permissions' },
+ { title: 'Access Control',
+ children: [
+ { title: 'Roles' },
+ { title: 'Permissions' },
+ ]
+ },
]
},
{
diff --git a/src/private/LoginPage.jsx b/src/private/LoginPage.jsx
index e37e406..662d76a 100644
--- a/src/private/LoginPage.jsx
+++ b/src/private/LoginPage.jsx
@@ -13,7 +13,7 @@ export default function LoginPage() {
const navigate = useNavigate();
return (
-
+
Login to Dream Views