"use client"; import { useCopy } from "@calcom/lib/hooks/useCopy"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import { Button } from "@calcom/ui/components/button"; import { showToast } from "@calcom/ui/components/toast"; import { useInsightsBookingParameters } from "@calcom/web/modules/insights/hooks/useInsightsBookingParameters"; import { ChartCard, ChartCardItem } from "../ChartCard"; export const RecentNoShowGuestsChart = () => { const { t } = useLocale(); const { copyToClipboard, isCopied } = useCopy(); const insightsBookingParams = useInsightsBookingParameters(); const timeZone = insightsBookingParams.timeZone; const { data, isSuccess, isPending, isError } = trpc.viewer.insights.recentNoShowGuests.useQuery( insightsBookingParams, { staleTime: 180000, refetchOnWindowFocus: false, trpc: { context: { skipBatch: true }, }, } ); const handleCopyEmail = (email: string) => { copyToClipboard(email); showToast(t("email_copied"), "success"); }; return ( {isSuccess && data ? (
{data.map((item) => (

{item.guestName}

{item.eventTypeName}

{Intl.DateTimeFormat(undefined, { timeZone, dateStyle: "medium", timeStyle: "short", }).format(new Date(item.startTime))}

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

{t("insights_no_data_found_for_filter")}

)}
) : null} ); };