"use client"; import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Rectangle, } from "recharts"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { trpc } from "@calcom/trpc/react"; import type { RouterOutputs } from "@calcom/trpc/react"; import { useInsightsBookingParameters } from "@calcom/web/modules/insights/hooks/useInsightsBookingParameters"; import { ChartCard } from "../ChartCard"; type BookingsByHourData = RouterOutputs["viewer"]["insights"]["bookingsByHourStats"][number]; export const BookingsByHourChartContent = ({ data }: { data: BookingsByHourData[] }) => { const { t } = useLocale(); const chartData = data.map((item) => ({ hour: `${item.hour.toString().padStart(2, "0")}:00`, count: item.count, })); const maxBookings = Math.max(...data.map((item) => item.count)); const isEmpty = maxBookings === 0; if (isEmpty) { return (
{t("insights_no_data_found_for_filter")}
{label}
{payload.map((entry, index: number) => ({t("bookings")}: {entry.value}
))}