Fix board funnel/goal preview

This commit is contained in:
Francis Cao committed 2026-07-08 11:11:55 -07:00
1 parent 28230ee471
commit 31c479cf5e
4 files changed
+49 -9

No files matched your search

@@ -7,10 +7,12 @@ function BoardComponentRendererComponent({
config,
websiteId,
entityType,
isPreview,
}: {
config: BoardComponentConfig;
websiteId?: string;
entityType?: string;
isPreview?: boolean;
}) {
const definition = getComponentDefinition(config.type);
@@ -33,7 +35,13 @@ function BoardComponentRendererComponent({
);
}
return <Component {...(websiteId ? { websiteId } : {})} {...config.props} />;
return (
<Component
{...(websiteId ? { websiteId } : {})}
{...(isPreview ? { isPreview } : {})}
{...config.props}
/>
);
}
export const BoardComponentRenderer = memo(
@@ -41,6 +49,7 @@ export const BoardComponentRenderer = memo(
(prevProps, nextProps) =>
prevProps.websiteId === nextProps.websiteId &&
prevProps.entityType === nextProps.entityType &&
prevProps.isPreview === nextProps.isPreview &&
prevProps.config === nextProps.config,
);
@@ -508,6 +508,7 @@ export function BoardComponentSelect({
config={previewConfig}
websiteId={resolvedEntityId}
entityType={resolvedEntityType}
isPreview
/>
) : (
<Column alignItems="center" justifyContent="center" height="100%">
@@ -5,15 +5,30 @@ import { Link2Off } from '@/components/icons';
import { useReportQuery } from '@/components/hooks/queries/useReportQuery';
import { Funnel } from './Funnel';
export function BoardFunnel({ websiteId, reportId }: { websiteId: string; reportId?: string }) {
export function BoardFunnel({
websiteId,
reportId,
isPreview,
}: {
websiteId: string;
reportId?: string;
isPreview?: boolean;
}) {
const { data, isLoading, error, isFetching } = useReportQuery(reportId || '');
if (!reportId) {
return (
<EmptyPlaceholder
icon={<Link2Off />}
title="Reconnect funnel"
description="Choose a funnel for this website."
{...(isPreview
? {
title: 'Select a funnel',
description: 'Choose a saved funnel to preview.',
}
: {
icon: <Link2Off />,
title: 'Reconnect funnel',
description: 'Choose a funnel for this website.',
})}
/>
);
}
@@ -6,7 +6,15 @@ import { Link2Off } from '@/components/icons';
import { useReportQuery } from '@/components/hooks/queries/useReportQuery';
import { Goal } from './Goal';
export function BoardGoal({ websiteId, reportId }: { websiteId: string; reportId?: string }) {
export function BoardGoal({
websiteId,
reportId,
isPreview,
}: {
websiteId: string;
reportId?: string;
isPreview?: boolean;
}) {
const {
dateRange: { startDate, endDate },
} = useDateRange();
@@ -15,9 +23,16 @@ export function BoardGoal({ websiteId, reportId }: { websiteId: string; reportId
if (!reportId) {
return (
<EmptyPlaceholder
icon={<Link2Off />}
title="Reconnect goal"
description="Choose a goal for this website."
{...(isPreview
? {
title: 'Select a goal',
description: 'Choose a saved goal to preview.',
}
: {
icon: <Link2Off />,
title: 'Reconnect goal',
description: 'Choose a goal for this website.',
})}
/>
);
}