diff --git a/app/components/chart-panel-layout-grid.tsx b/app/components/chart-panel-layout-grid.tsx index c8f4a00dd..a1045a8c6 100644 --- a/app/components/chart-panel-layout-grid.tsx +++ b/app/components/chart-panel-layout-grid.tsx @@ -32,8 +32,8 @@ const decodeLayouts = (layouts: Layouts) => { ); }; -const ChartPanelLayoutCanvas = (props: ChartPanelLayoutTypeProps) => { - const { chartConfigs } = props; +export const ChartPanelLayoutCanvas = (props: ChartPanelLayoutTypeProps) => { + const { chartConfigs, renderChart, className } = props; const [state, dispatch] = useConfiguratorState(hasChartConfigs); const [layouts, setLayouts] = useState(() => { assert( @@ -69,16 +69,14 @@ const ChartPanelLayoutCanvas = (props: ChartPanelLayoutTypeProps) => { return ( handleChangeLayouts(allLayouts)} + onLayoutChange={(_, allLayouts) => handleChangeLayouts(allLayouts)} breakpoints={FREE_CANVAS_BREAKPOINTS} > - {chartConfigs.map((chartConfig) => props.renderChart(chartConfig))} + {chartConfigs.map(renderChart)} ); }; - -export default ChartPanelLayoutCanvas; diff --git a/app/components/chart-panel.tsx b/app/components/chart-panel.tsx index 81bd9a237..1b99af979 100644 --- a/app/components/chart-panel.tsx +++ b/app/components/chart-panel.tsx @@ -3,7 +3,8 @@ import { makeStyles } from "@mui/styles"; import clsx from "clsx"; import React, { HTMLProps, forwardRef } from "react"; -import ChartPanelLayoutCanvas, { +import { + ChartPanelLayoutCanvas, chartPanelLayoutGridClasses, } from "@/components/chart-panel-layout-grid"; import { ChartPanelLayoutTall } from "@/components/chart-panel-layout-tall"; diff --git a/app/components/react-grid.tsx b/app/components/react-grid.tsx index 054f55048..f8285b40d 100644 --- a/app/components/react-grid.tsx +++ b/app/components/react-grid.tsx @@ -14,7 +14,6 @@ import { getChartWrapperId } from "@/components/chart-panel"; import { hasChartConfigs, isLayouting, - LayoutDashboardFreeCanvas, ReactGridLayoutType, } from "@/configurator"; import { useTimeout } from "@/hooks/use-timeout"; @@ -227,11 +226,11 @@ export const ChartGridLayout = ({ } & ComponentProps) => { const classes = useStyles(); const [state, dispatch] = useConfiguratorState(hasChartConfigs); + const configLayout = state.layout; assert( - state.layout.type === "dashboard" && state.layout.layout === "canvas", + configLayout.type === "dashboard" && configLayout.layout === "canvas", "ChartGridLayout can only be used in a canvas layout!" ); - const configLayout = state.layout as LayoutDashboardFreeCanvas; const allowHeightInitialization = isLayouting(state); const [mounted, setMounted] = useState(false); const mountedForSomeTime = useTimeout(500, mounted); diff --git a/app/configurator/components/layout-configurator.tsx b/app/configurator/components/layout-configurator.tsx index df4bf0b17..48f495e3f 100644 --- a/app/configurator/components/layout-configurator.tsx +++ b/app/configurator/components/layout-configurator.tsx @@ -243,8 +243,8 @@ const LayoutSharedFiltersConfigurator = () => { {/* TODO: allow TemporalOrdinalDimensions to work here */} {timeRange && combinedTemporalDimension.values.length ? ( <> - { checked={timeRange.active} onChange={handleTimeRangeFilterToggle} /> - + {timeRange.active ? ( { {dataFilters ? ( <> {potentialDataFilterIds.map((id, i) => { - const dimension = dimensions.find( - (dimension) => dimension.id === id - ); - if (!dimension) { + const dim = dimensions.find((d) => d.id === id); + + if (!dim) { return null; } - const checked = dataFilters.componentIds.includes( - dimension.id - ); + + const checked = dataFilters.componentIds.includes(dim.id); return ( - - - - {dimension.label} - + {dim.label} { - handleDataFiltersToggle(checked, dimension.id); + handleDataFiltersToggle(checked, dim.id); }} /> - + {checked ? ( { /> ) : null} - + ); })}