import React, { useEffect, useState } from 'react'; import { pb } from '../config/pocketbase'; interface User { id: string; email: string; emailVisibility: boolean; verified: boolean; name: string; role: string; company: string; mfa_enabled: boolean; created: string; updated: string } interface Company { id: string; name: string; no: string; vip_level: string; created: string; updated: string } // Définition stricte des propriétés attendues par le Layout interface DashboardLayoutProps { children: React.ReactNode; activeView: 'dashboard' | 'support' | 'vault' | 'account'; onNavigate: (view: 'dashboard' | 'support' | 'vault' | 'account') => void; onLogout: () => void; } export default function DashboardLayout({ children, activeView, onNavigate, onLogout }: DashboardLayoutProps) { const [user, setUser] = useState(null); const [company, setCompany] = useState(null); const [isLoading, setIsLoading] = useState(true); const fetchInformations = async () => { setIsLoading(true); try { const userRecords = await pb.collection('aegis_users').getFullList(); setUser(userRecords[0]); const companyRecords = await pb.collection('aegis_companies').getFullList(); setCompany(companyRecords[0]) } catch (error) { console.error("Erreur lors de la récupération des infos utilisateur :", error); } finally { setIsLoading(false); } }; useEffect(()=>{ fetchInformations(); },[]); const navItems = [ { id: 'dashboard', label: 'Tableau de bord', icon: ( )}, { id: 'support', label: 'Centre de Support', icon: ( )}, { id: 'vault', label: 'Coffre-Fort', icon: ( )} ]; return (
{/* Sidebar Latérale (Institutionnelle) */} {/* Zone de contenu principal */}
{children}
); }