"use client"; import { type ComponentRenderProps } from "@json-render/react"; import { useData } from "@json-render/react"; import { getByPath } from "@json-render/core"; export function Chart({ element }: ComponentRenderProps) { const { title, dataPath } = element.props as { title?: string | null; dataPath: string; }; const { data } = useData(); const chartData = getByPath(data, dataPath) as | Array<{ label: string; value: number }> | undefined; if (!chartData || !Array.isArray(chartData)) { return