v2.1
Ship configurator updates with catalog DB included for server deploy. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -1,10 +1,25 @@
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { Link, NavLink, useNavigate } from 'react-router-dom';
|
||||
import { useAuth } from '../context/AuthContext';
|
||||
import styles from './Layout.module.css';
|
||||
|
||||
const navClass = ({ isActive }) => (isActive ? styles.navActive : undefined);
|
||||
|
||||
export default function Layout({ children }) {
|
||||
const { isAdmin, logout } = useAuth();
|
||||
const navigate = useNavigate();
|
||||
const headerRef = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
const header = headerRef.current;
|
||||
if (!header) return undefined;
|
||||
const root = document.documentElement;
|
||||
const update = () => root.style.setProperty('--header-height', `${header.offsetHeight}px`);
|
||||
update();
|
||||
const observer = new ResizeObserver(update);
|
||||
observer.observe(header);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
const handleLogout = () => {
|
||||
logout();
|
||||
@@ -13,16 +28,16 @@ export default function Layout({ children }) {
|
||||
|
||||
return (
|
||||
<div className={styles.app}>
|
||||
<header className={styles.header}>
|
||||
<header ref={headerRef} className={styles.header}>
|
||||
<Link to="/" className={styles.logo}>SIGNATURE</Link>
|
||||
<nav>
|
||||
{isAdmin ? (
|
||||
<>
|
||||
<Link to="/">Accueil</Link>
|
||||
<Link to="/configurateur">Configurateur</Link>
|
||||
<Link to="/materiaux">Matériaux</Link>
|
||||
<Link to="/admin">Admin</Link>
|
||||
<Link to="/parametres">Paramètres</Link>
|
||||
<NavLink to="/" end className={navClass}>Accueil</NavLink>
|
||||
<NavLink to="/configurateur" className={navClass}>Configurateur</NavLink>
|
||||
<NavLink to="/materiaux" className={navClass}>Matériaux</NavLink>
|
||||
<NavLink to="/admin" className={navClass}>Admin</NavLink>
|
||||
<NavLink to="/parametres" className={navClass}>Paramètres</NavLink>
|
||||
<button type="button" className={styles.logoutBtn} onClick={handleLogout}>Déconnexion</button>
|
||||
</>
|
||||
) : (
|
||||
@@ -33,6 +48,15 @@ export default function Layout({ children }) {
|
||||
<main className={styles.main}>
|
||||
{children}
|
||||
</main>
|
||||
<footer className={styles.footer}>
|
||||
<span className={styles.footerBrand}>© {new Date().getFullYear()} SIGNATURE</span>
|
||||
<nav className={styles.footerNav}>
|
||||
<Link to="/mentions-legales">Mentions légales</Link>
|
||||
<Link to="/confidentialite">Politique de confidentialité</Link>
|
||||
<Link to="/conditions-generales">Conditions générales</Link>
|
||||
<Link to="/reglements">Règlements</Link>
|
||||
</nav>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user