import React, { createContext, type ReactNode, useCallback, useContext, useRef, } from "react"; import { IntroSheet, type IntroSheetRef } from "@/components/IntroSheet"; interface IntroSheetContextType { showIntro: () => void; hideIntro: () => void; } const IntroSheetContext = createContext( undefined, ); export const useIntroSheet = () => { const context = useContext(IntroSheetContext); if (!context) { throw new Error("useIntroSheet must be used within IntroSheetProvider"); } return context; }; interface IntroSheetProviderProps { children: ReactNode; } export const IntroSheetProvider: React.FC = ({ children, }) => { const sheetRef = useRef(null); const showIntro = useCallback(() => { sheetRef.current?.present(); }, []); const hideIntro = useCallback(() => { sheetRef.current?.dismiss(); }, []); const value = { showIntro, hideIntro, }; return ( {children} ); };