42 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { useState } from 'react'
 | |
| import './App.css'
 | |
| import AppHeader from './components/AppHeader';
 | |
| import Footer from './components/Footer';
 | |
| import Box from '@mui/material/Box';
 | |
| 
 | |
| import Products from './private/products/Products';
 | |
| import Clients from './private/clients/Clients';
 | |
| 
 | |
| function App() {
 | |
|   const [zone, setZone] = useState('public'); // Could be 'public' | 'restricted' | 'private'
 | |
|   const [currentView, setCurrentView] = useState('Products');
 | |
| 
 | |
|   return (
 | |
|     <>
 | |
|       <Box
 | |
|         sx={{
 | |
|           display: 'flex',
 | |
|           flexDirection: 'column',
 | |
|           minHeight: '100vh', // full height of the viewport
 | |
|         }}
 | |
|       >
 | |
| 
 | |
|         <AppHeader zone={zone} onSelectMenuItem={(view) => setCurrentView(view)} />
 | |
| 
 | |
|         {/* Main content area */}
 | |
|         <Box component="main" sx={{ flex: 1, p: 2 }}>
 | |
|           {zone === 'private' && <Clients />}
 | |
|           {zone === 'restricted' && <Clients />}
 | |
| 
 | |
|           {zone === 'public' && currentView === 'Products' && <Products />}
 | |
|           {zone === 'public' && currentView === 'Clients' && <Clients />}
 | |
|         </Box>
 | |
|         <Footer zone={zone} />
 | |
|       </Box>
 | |
| 
 | |
|     </>
 | |
|   )
 | |
| }
 | |
| 
 | |
| export default App
 | 
