feat: guide drawer inline + hook partagé useGuideData
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 34s

- GuideDrawer: panneau coulissant depuis la sidebar, recherche live
- useGuideData: hook unique — même cache React Query pour drawer + page
- Sidebar: BookOpen toggle le drawer (pas de navigation)
- Footer drawer: lien vers /guide complet
- GuidePage refactorisée sur useGuideData (zéro duplication)
This commit is contained in:
2026-03-24 21:32:29 +01:00
parent 84104cd96f
commit dbdc02f4ab
4 changed files with 274 additions and 44 deletions

View File

@@ -1,7 +1,9 @@
import { useState } from 'react';
import { Link, useLocation } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
import { Swords, Package, Hammer, User, LogOut, Shield, Scroll, Trophy, ShoppingBag, BookOpen } from 'lucide-react';
import { HudBar } from './HudBar';
import { GuideDrawer } from './GuideDrawer';
const NAV = [
{ to: '/dashboard', icon: User, label: 'Personnage' },
@@ -17,6 +19,7 @@ const NAV = [
export function Layout({ children }: { children: React.ReactNode }) {
const { user, logout } = useAuth();
const loc = useLocation();
const [guideOpen, setGuideOpen] = useState(false);
return (
<div style={{ minHeight: '100vh', display: 'flex', flexDirection: 'column' }}>
@@ -84,21 +87,25 @@ export function Layout({ children }: { children: React.ReactNode }) {
);
})}
<div style={{ flex: 1 }} />
<Link to="/guide" title="Guide" style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
width: 40,
height: 40,
borderRadius: 8,
color: loc.pathname === '/guide' ? '#f4c94e' : '#6b7a99',
background: loc.pathname === '/guide' ? '#1e2535' : 'transparent',
border: loc.pathname === '/guide' ? '1px solid #c49c2e' : '1px solid transparent',
textDecoration: 'none',
transition: 'all 0.15s',
}}>
<button
onClick={() => setGuideOpen(true)}
title="Guide rapide"
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
width: 40,
height: 40,
borderRadius: 8,
color: guideOpen ? '#f4c94e' : '#6b7a99',
background: guideOpen ? '#1e2535' : 'transparent',
border: guideOpen ? '1px solid #c49c2e' : '1px solid transparent',
cursor: 'pointer',
transition: 'all 0.15s',
}}
>
<BookOpen size={18} />
</Link>
</button>
</nav>
{/* Main content */}
@@ -106,6 +113,8 @@ export function Layout({ children }: { children: React.ReactNode }) {
{children}
</main>
</div>
<GuideDrawer open={guideOpen} onClose={() => setGuideOpen(false)} />
</div>
);
}