Skip to content

Commit

Permalink
feat: Add layout annotations in published chart
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Dec 7, 2023
1 parent 73affe2 commit df9e839
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions app/components/chart-published.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,47 @@ export const ChartPublished = (props: ChartPublishedProps) => {
const { configKey } = props;
const [state] = useConfiguratorState(isPublished);
const { dataSource } = state;
const chartConfig = getChartConfig(state);
const locale = useLocale();

return (
<ChartTablePreviewProvider>
{state.layout.type === "dashboard" ? (
<ChartPanelLayout type={state.layout.layout}>
{state.chartConfigs.map((chartConfig) => (
<ChartWrapper key={chartConfig.key} layout={state.layout}>
<ChartPublishedInner
dataSource={dataSource}
state={state}
chartConfig={chartConfig}
configKey={configKey}
/>
</ChartWrapper>
))}
</ChartPanelLayout>
<>
<Box
sx={{
mb:
state.layout.meta.title[locale] ||
state.layout.meta.description[locale]
? 4
: 0,
}}
>
{state.layout.meta.title[locale] && (
<Title text={state.layout.meta.title[locale]} />
)}
{state.layout.meta.description[locale] && (
<Description text={state.layout.meta.description[locale]} />
)}
</Box>
<ChartPanelLayout type={state.layout.layout}>
{state.chartConfigs.map((chartConfig) => (
<ChartWrapper key={chartConfig.key} layout={state.layout}>
<ChartPublishedInner
dataSource={dataSource}
state={state}
chartConfig={chartConfig}
configKey={configKey}
/>
</ChartWrapper>
))}
</ChartPanelLayout>
</>
) : (
<ChartWrapper layout={state.layout}>
<ChartPublishedInner
dataSource={dataSource}
state={state}
chartConfig={chartConfig}
chartConfig={getChartConfig(state)}
configKey={configKey}
/>
</ChartWrapper>
Expand Down

0 comments on commit df9e839

Please sign in to comment.