import React, { useContext, createContext, type PropsWithChildren, } from "react"; interface PolarChartContext { data: Record[]; canvasSize: { width: number; height: number }; labelKey: string; valueKey: string; colorKey: string; } const PolarChartContext = createContext( undefined, ); interface PolarChartProviderProps { data: Record[]; canvasSize: { width: number; height: number }; labelKey: string; valueKey: string; colorKey: string; } export const PolarChartProvider = ( props: PropsWithChildren, ) => { const { children, data, canvasSize, labelKey, valueKey, colorKey } = props; return ( {children} ); }; export const usePolarChartContext = () => { const context = useContext(PolarChartContext); if (context === undefined) { throw new Error( "usePolarChartContext must be used within a PolarChartProvider", ); } return context; };