MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / FunnelUsersView

Function FunnelUsersView

apps/start/src/modals/view-chart-users.tsx:295–390  ·  view source on GitHub ↗
({ report, stepIndex, breakdownValues }: FunnelUsersViewProps)

Source from the content-addressed store, hash-verified

293}
294
295function FunnelUsersView({ report, stepIndex, breakdownValues }: FunnelUsersViewProps) {
296 const trpc = useTRPC();
297 const [showDropoffs, setShowDropoffs] = useState(false);
298
299 const profilesQuery = useQuery(
300 trpc.chart.getFunnelProfiles.queryOptions(
301 {
302 projectId: report.projectId,
303 startDate: report.startDate!,
304 endDate: report.endDate!,
305 range: report.range,
306 series: report.series.map((item) =>
307 item.type === 'event'
308 ? {
309 ...item,
310 filters: [...(report.globalFilters ?? []), ...item.filters],
311 }
312 : item,
313 ),
314 stepIndex: stepIndex,
315 showDropoffs: showDropoffs,
316 funnelWindow:
317 report.options?.type === 'funnel'
318 ? report.options.funnelWindow
319 : undefined,
320 funnelGroup:
321 report.options?.type === 'funnel'
322 ? report.options.funnelGroup
323 : undefined,
324 breakdowns: report.breakdowns,
325 breakdownValues: breakdownValues,
326 },
327 {
328 enabled: stepIndex !== undefined,
329 },
330 ),
331 );
332
333 const profiles = profilesQuery.data ?? [];
334 const isLastStep = stepIndex === report.series.length - 1;
335
336 return (
337 <ScrollableModal
338 header={
339 <div className="flex flex-col gap-2">
340 <ModalHeader
341 title="View Users"
342 text={
343 showDropoffs
344 ? `Users who dropped off after step ${stepIndex + 1} of ${report.series.length}`
345 : `Users who completed step ${stepIndex + 1} of ${report.series.length} in the funnel`
346 }
347 />
348 {!isLastStep && (
349 <div className="flex items-center gap-2">
350 <button
351 type="button"
352 onClick={() => setShowDropoffs(false)}

Callers

nothing calls this directly

Calls 2

cnFunction · 0.90
mapMethod · 0.45

Tested by

no test coverage detected