import { createContext, useContext } from 'react'; import type { BaseEntity } from '@repo/core-api/data-services'; export interface IndexPageContextValue { renderRowActions: (row: E) => React.ReactNode; refreshGrid: () => void; // State for batch modals isConfirmModalOpen: boolean; setIsConfirmModalOpen: (open: boolean) => void; isDeleteModalOpen: boolean; setIsDeleteModalOpen: (open: boolean) => void; } export const IndexPageContext = createContext | null>(null); export function useIndexPageContext(): IndexPageContextValue { const context = useContext(IndexPageContext); if (!context) { throw new Error('useIndexPageContext must be used within an IndexPageProvider'); } return context; }