import { createContext, useContext } from "react"; import { type SidebarEntityCardSectionsProps } from "@marzneshin/libs/entity-table/components"; interface SidebarEntityTableContextProps { sidebarEntityId?: string; setSidebarEntityId: (s: string | undefined) => void; sidebarEntities: SData[]; sidebarCardProps: SidebarEntityCardSectionsProps; } export const SidebarEntityTableContext = createContext | null>(null); export const useSidebarEntityTableContext = () => { const ctx = useContext(SidebarEntityTableContext); if (!ctx) throw new Error('SidebarEntityTable.* component must be rendered as child of SidebarEntityTable'); return ctx; }