Skip to content
Snippets Groups Projects
Unverified Commit 22bf4ccb authored by Aleksandr Lesnenko's avatar Aleksandr Lesnenko Committed by GitHub
Browse files

fix night theme png downloads (#44941)

* include dark background to PNG exports when night theme is enabled

* fix css

* override border for png downloads
parent 6e472b38
No related branches found
No related tags found
No related merge requests found
import { css, type Theme } from "@emotion/react";
import styled from "@emotion/styled";
import { SAVING_DOM_IMAGE_CLASS } from "metabase/visualizations/lib/save-chart-image";
export interface DashCardRootProps {
isNightMode: boolean;
isUsuallySlow: boolean;
......@@ -38,6 +40,11 @@ export const DashCardRoot = styled.div<DashCardRootProps>`
${({ shouldForceHiddenBackground }) =>
shouldForceHiddenBackground && hiddenBackgroundStyle}
&.${SAVING_DOM_IMAGE_CLASS} {
border-radius: 0;
border: none !important;
}
`;
export const VirtualDashCardOverlayRoot = styled.div`
......
......@@ -275,6 +275,7 @@ function DashCardInner({
<ErrorBoundary>
<DashCardRoot
data-testid="dashcard"
data-dashcard-key={dashcard.id}
className={cx(
DashboardS.Card,
EmbedFrameS.Card,
......
......@@ -43,9 +43,15 @@ export const downloadQueryResults =
}
};
const downloadChart = async ({ question }: DownloadQueryResultsOpts) => {
const downloadChart = async ({
question,
dashcardId,
}: DownloadQueryResultsOpts) => {
const fileName = getChartFileName(question);
const chartSelector = `[data-card-key='${getCardKey(question.id())}']`;
const chartSelector =
dashcardId != null
? `[data-dashcard-key='${dashcardId}']`
: `[data-card-key='${getCardKey(question.id())}']`;
await saveChartImage(chartSelector, fileName);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment