"use client"; import { createContext, useContext, useState, ReactNode } from "react"; interface UserInfo { firstName: string; lastName: string; teamName: string; teamId?: string; uuid?: string; } interface UserContextType { userInfo: UserInfo | null; setUserInfo: (userInfo: UserInfo | null) => void; loading: boolean; } const UserContext = createContext(undefined); interface UserProviderProps { children: ReactNode; initialUserInfo: UserInfo | null; } export function UserProvider({ children, initialUserInfo }: UserProviderProps) { const [userInfo, setUserInfo] = useState(initialUserInfo); const [loading, setLoading] = useState(false); // Plus de loading initial return ( {children} ); } export function useUser() { const context = useContext(UserContext); if (context === undefined) { throw new Error("useUser must be used within a UserProvider"); } return context; }