From 4c306ac28755a5119e34c4a620565ea507ca9d43 Mon Sep 17 00:00:00 2001 From: "Rudy B." Date: Mon, 16 Mar 2026 21:51:16 +0100 Subject: [PATCH] feat(funnels): display per-step filters in funnel overview --- .../[websiteId]/(reports)/funnels/Funnel.tsx | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/src/app/(main)/websites/[websiteId]/(reports)/funnels/Funnel.tsx b/src/app/(main)/websites/[websiteId]/(reports)/funnels/Funnel.tsx index e336a3db6..a16a802c3 100644 --- a/src/app/(main)/websites/[websiteId]/(reports)/funnels/Funnel.tsx +++ b/src/app/(main)/websites/[websiteId]/(reports)/funnels/Funnel.tsx @@ -1,16 +1,15 @@ import { Box, Column, Dialog, Grid, Icon, ProgressBar, Row, Text } from '@umami/react-zen'; import { LoadingPanel } from '@/components/common/LoadingPanel'; -import { useMessages, useResultQuery } from '@/components/hooks'; +import { useMessages, useOperatorLabels, useResultQuery } from '@/components/hooks'; import { File, User } from '@/components/icons'; import { ReportEditButton } from '@/components/input/ReportEditButton'; import { ChangeLabel } from '@/components/metrics/ChangeLabel'; import { Lightning } from '@/components/svg'; import { formatLongNumber } from '@/lib/format'; +import type { FunnelStep } from '@/queries/sql/reports/getFunnel'; import { FunnelEditForm } from './FunnelEditForm'; -type FunnelResult = { - type: string; - value: string; +type FunnelResult = FunnelStep & { visitors: number; previous: number; dropped: number; @@ -18,13 +17,23 @@ type FunnelResult = { remaining: number; }; -export function Funnel({ id, name, type, parameters, websiteId }) { +interface FunnelProps { + id: string; + name: string; + type: string; + parameters: Record; + websiteId: string; +} + +export function Funnel({ id, name, type, parameters, websiteId }: FunnelProps) { const { formatMessage, labels } = useMessages(); - const { data, error, isLoading } = useResultQuery(type, { + const { data, error, isLoading } = useResultQuery>(type, { websiteId, ...parameters, }); + const operatorLabels = useOperatorLabels(); + return ( @@ -54,7 +63,7 @@ export function Funnel({ id, name, type, parameters, websiteId }) { {data?.map( ( - { type, value, visitors, previous, dropped, dropoff, remaining }: FunnelResult, + { type, value, filters, visitors, previous, dropped, dropoff, remaining }: FunnelResult, index: number, ) => { const isPage = type === 'path'; @@ -92,10 +101,25 @@ export function Funnel({ id, name, type, parameters, websiteId }) { {formatMessage(labels.conversionRate)} - - {type === 'path' ? : } - {value} - + + + {type === 'path' ? : } + {value} + + {filters?.map((f, i) => ( + + + {f.property} + + + {operatorLabels[f.operator] ?? f.operator} + + + {f.value} + + + ))} + {index > 0 && (