import { createContext, useContext } from "react"; import type { RouterOutputs } from "@homarr/api"; import type { DynamicSectionItem, Section, SectionItem } from "~/app/[locale]/boards/_types"; interface SectionContextProps { section: Exclude | DynamicSectionItem; innerSections: DynamicSectionItem[]; items: SectionItem[]; integrations: RouterOutputs["integration"]["all"] | undefined; columnCount: number; maxRowCount: number | null; announce: (message: string) => void; } const SectionContext = createContext(null); export const useSectionContext = () => { const context = useContext(SectionContext); if (!context) { throw new Error("useSectionContext must be used within a SectionContext"); } return context; }; export const SectionProvider = SectionContext.Provider;