From 6a8e8847eae021224af1b0b69f63258545e650c1 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Thu, 5 Dec 2024 11:17:49 +0100 Subject: [PATCH] feat: Use better names for downloaded images --- app/components/chart-shared.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/components/chart-shared.tsx b/app/components/chart-shared.tsx index cd55e2123..94946606b 100644 --- a/app/components/chart-shared.tsx +++ b/app/components/chart-shared.tsx @@ -137,6 +137,7 @@ export const ChartMoreButton = ({ chartKey: string; chartWrapperNode?: HTMLElement | null; }) => { + const locale = useLocale(); const [state, dispatch] = useConfiguratorState(hasChartConfigs); const [anchor, setAnchor] = useState(null); const handleClose = useEventCallback(() => setAnchor(null)); @@ -153,6 +154,12 @@ export const ChartMoreButton = ({ state.layout.type === "dashboard" && chartConfig.chartType === "table"; + const screenshotName = useMemo(() => { + const date = timeUnitToFormatter.Day(new Date()); + const label = chartConfig.meta.title[locale] || chartConfig.chartType; + return `${date}_${label}`; + }, [chartConfig.meta.title, chartConfig.chartType, locale]); + return disableButton ? null : ( <> @@ -218,7 +225,7 @@ export const ChartMoreButton = ({ />