diff --git a/CHANGELOG.md b/CHANGELOG.md index 325f820204..c6a6e47166 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ You can also check the - Use most recent value toggle is now correctly displaying in the single filters section - Dataset browse view is now correctly displayed on mobile devices + - Database-related actions are now hidden in preview mode (copy URL, share) - Security - Added additional protection against data source URL injection - Removed feature flag for custom GraphQL endpoint diff --git a/app/components/chart-published.tsx b/app/components/chart-published.tsx index 230971811e..e3295e062b 100644 --- a/app/components/chart-published.tsx +++ b/app/components/chart-published.tsx @@ -124,10 +124,12 @@ export const ChartPublished = ({ configKey, embedParams, shouldShrink, + isPreview, }: { configKey?: string; embedParams?: EmbedQueryParams; shouldShrink?: boolean; + isPreview?: boolean; }) => { const [state] = useConfiguratorState(isPublished); const { dataSource } = state; @@ -234,6 +236,7 @@ export const ChartPublished = ({ metadataPanelStore={metadataPanelStore} embedParams={embedParams} shouldShrink={shouldShrink} + isPreview={isPreview} /> @@ -285,6 +288,7 @@ type ChartPublishInnerProps = { metadataPanelStore: ReturnType; embedParams?: EmbedQueryParams; shouldShrink?: boolean; + isPreview?: boolean; }; const ChartPublishedInnerImpl = ({ @@ -297,6 +301,7 @@ const ChartPublishedInnerImpl = ({ metadataPanelStore, embedParams, shouldShrink: _shouldShrink, + isPreview, }: ChartPublishInnerProps) => { const { meta } = chartConfig; const rootRef = useRef(null); @@ -448,6 +453,7 @@ const ChartPublishedInnerImpl = ({ chartKey={chartConfig.key} chartWrapperNode={rootRef.current} components={allComponents} + disableDatabaseRelatedActions={isPreview} /> )} diff --git a/app/components/chart-shared.tsx b/app/components/chart-shared.tsx index 2c1f7104b5..68bd5f3914 100644 --- a/app/components/chart-shared.tsx +++ b/app/components/chart-shared.tsx @@ -164,11 +164,13 @@ export const ChartMoreButton = ({ chartKey, chartWrapperNode, components, + disableDatabaseRelatedActions, }: { configKey?: string; chartKey: string; chartWrapperNode?: HTMLElement | null; components: Component[]; + disableDatabaseRelatedActions?: boolean; }) => { const locale = useLocale(); const [state, dispatch] = useConfiguratorState(hasChartConfigs); @@ -227,7 +229,9 @@ export const ChartMoreButton = ({ /> ) : null} - {state.layout.type !== "dashboard" && configKey ? ( + {state.layout.type !== "dashboard" && + configKey && + !disableDatabaseRelatedActions ? ( <> diff --git a/app/pages/preview.tsx b/app/pages/preview.tsx index 092d2bcd27..ad89eb56d3 100644 --- a/app/pages/preview.tsx +++ b/app/pages/preview.tsx @@ -8,10 +8,10 @@ import { ConfiguratorStatePublished, decodeConfiguratorState, } from "@/config-types"; +import { ConfiguratorStateProvider } from "@/configurator/configurator-state"; import { GraphqlProvider } from "@/graphql/graphql-provider"; import { i18n } from "@/locales/locales"; import { LocaleProvider, useLocale } from "@/locales/use-locale"; -import { ConfiguratorStateProvider } from "@/src"; import * as federalTheme from "@/themes/theme"; import { migrateConfiguratorState } from "@/utils/chart-config/versioning"; import { hashStringToObject } from "@/utils/hash-utils"; @@ -101,7 +101,7 @@ export default function Preview() { chartId="published" initialState={state} > - + ) : null} diff --git a/app/pages/preview_post.tsx b/app/pages/preview_post.tsx index 1873d5f854..5cd1860f1b 100644 --- a/app/pages/preview_post.tsx +++ b/app/pages/preview_post.tsx @@ -82,7 +82,11 @@ export default function Preview({ configuratorState, locale }: PageProps) { chartId="published" initialState={parsedState} > - + ) : null}