Files
calendar/packages/features/insights/components/RoutingFunnel.tsx
T
Eunjae LeeGitHubcubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
10fca86ddc feat: add drop off funnel chart for /insights/routing (#22106)
* feat: add Drop-off funnel chart for /insights/routing

* convert insights services to use kysely

* WIP

* implement drop-off data WIP

* updates

* revert services back to Prisma

* do not expose findMany

* WIP

* revert usage

* fix type errors

* updates

* clean up

* update playground

* update styles

* support columnFilters

* update tooltip

* add skeleton

* remove dynamic loading

* avoid using Prisma.raw

* update condition for user scope

* Update packages/features/insights/components/RoutingFunnelContent.tsx

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* playground fix

* fix type error

* update playground

* update styles

* implement subtitle to ChartCard

* revert insights booking service

* update border

* update ChartCard style

* style updates

* convert the playground to a client component

* clean up

* apply feedback

* fix tests

* fix unit test

* hide scrollbar

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2025-07-16 16:36:41 +02:00

48 lines
1.3 KiB
TypeScript

"use client";
import { useColumnFilters } from "@calcom/features/data-table";
import { useInsightsParameters } from "@calcom/features/insights/hooks/useInsightsParameters";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc";
import { ChartCard } from "./ChartCard";
import { RoutingFunnelContent, legend } from "./RoutingFunnelContent";
import { RoutingFunnelSkeleton } from "./RoutingFunnelSkeleton";
export function RoutingFunnel() {
const { t } = useLocale();
const { scope, selectedTeamId, startDate, endDate } = useInsightsParameters();
const columnFilters = useColumnFilters({
exclude: ["createdAt"],
});
const { data, isSuccess, isLoading } = trpc.viewer.insights.getRoutingFunnelData.useQuery(
{
scope,
selectedTeamId,
startDate,
endDate,
columnFilters,
},
{
staleTime: 30000,
trpc: {
context: { skipBatch: true },
},
}
);
if (isLoading || !isSuccess || !data) {
return (
<ChartCard title={t("routing_funnel")} legend={legend}>
<RoutingFunnelSkeleton />
</ChartCard>
);
}
return (
<ChartCard title={t("routing_funnel")} legend={legend}>
<RoutingFunnelContent data={data} />
</ChartCard>
);
}