Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

Fix board funnel/goal preview

Francis Cao31c479cf5e56
diff --git a/src/app/(main)/boards/[boardId]/BoardComponentRenderer.tsx b/src/app/(main)/boards/[boardId]/BoardComponentRenderer.tsx
index ec2a30df1..242a33436 100644
--- a/src/app/(main)/boards/[boardId]/BoardComponentRenderer.tsx
+++ b/src/app/(main)/boards/[boardId]/BoardComponentRenderer.tsx
@@ -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,
);
diff --git a/src/app/(main)/boards/[boardId]/BoardComponentSelect.tsx b/src/app/(main)/boards/[boardId]/BoardComponentSelect.tsx
index 51cd24fb6..b87ebbac8 100644
--- a/src/app/(main)/boards/[boardId]/BoardComponentSelect.tsx
+++ b/src/app/(main)/boards/[boardId]/BoardComponentSelect.tsx
@@ -508,6 +508,7 @@ export function BoardComponentSelect({
config={previewConfig}
websiteId={resolvedEntityId}
entityType={resolvedEntityType}
+ isPreview
/>
) : (
<Column alignItems="center" justifyContent="center" height="100%">
diff --git a/src/app/(main)/websites/[websiteId]/(reports)/funnels/BoardFunnel.tsx b/src/app/(main)/websites/[websiteId]/(reports)/funnels/BoardFunnel.tsx
index 63876fe8d..4905170df 100644
--- a/src/app/(main)/websites/[websiteId]/(reports)/funnels/BoardFunnel.tsx
+++ b/src/app/(main)/websites/[websiteId]/(reports)/funnels/BoardFunnel.tsx
@@ -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.',
+ })}
/>
);
}
diff --git a/src/app/(main)/websites/[websiteId]/(reports)/goals/BoardGoal.tsx b/src/app/(main)/websites/[websiteId]/(reports)/goals/BoardGoal.tsx
index 7e68181e7..c5861213c 100644
--- a/src/app/(main)/websites/[websiteId]/(reports)/goals/BoardGoal.tsx
+++ b/src/app/(main)/websites/[websiteId]/(reports)/goals/BoardGoal.tsx
@@ -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.',
+ })}
/>
);
}