import React, { createContext, useState, useContext, ReactNode } from 'react'; interface ActionContextType { getText: boolean; getScreenshot: boolean; handleGetText: () => void; handleGetScreenshot: () => void; resetActions: () => void; } const ActionContext = createContext(undefined); export const useActionContext = (): ActionContextType => { const context = useContext(ActionContext); if (context === undefined) { throw new Error('useActionContext must be used within an ActionProvider'); } return context; }; interface ActionProviderProps { children: ReactNode; } export const ActionProvider: React.FC = ({ children }) => { const [getText, setGetText] = useState(false); const [getScreenshot, setGetScreenshot] = useState(false); const handleGetText = () => setGetText(true); const handleGetScreenshot = () => setGetScreenshot(true); // Reset actions (optional) const resetActions = () => { setGetText(false); setGetScreenshot(false); }; return ( {children} ); };