import { createContext, useContext, useMemo, useState } from "react"; export type DialogContext = { animating: boolean; setAnimating: (isAnimating: boolean) => void; }; /** * Context for the dialogs (Guide/Modal) being rendered. * This helps control the dialog's behavior from within any nested component. */ const DialogContext = createContext({ animating: false, setAnimating: () => {}, }); export function DialogProvider({ children }: { children: React.ReactNode }) { const [animating, setAnimating] = useState(false); const ctx = useMemo( () => ({ animating, setAnimating, }), [animating] ); return ( {children} ); } export const useDialogContext = () => useContext(DialogContext);