"use client"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc"; import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters"; import { ChartCard, ChartCardItem } from "../ChartCard"; import { LoadingInsight } from "../LoadingInsights"; export const PopularEventsTable = () => { const { t } = useLocale(); const insightsBookingParams = useInsightsBookingParameters(); const { data, isSuccess, isPending } = trpc.viewer.insights.popularEvents.useQuery(insightsBookingParams, { staleTime: 180000, refetchOnWindowFocus: false, trpc: { context: { skipBatch: true }, }, }); if (isPending) return ; if (!isSuccess || !data) return null; return (
{data .filter((item) => item.eventTypeId) .map((item) => (

{item.eventTypeName}

))}
{data.length === 0 && (

{t("insights_no_data_found_for_filter")}

)} ); };