* refactor: improve most booked & least booked * add 2 new charts and trpc handlers * update arg * update comment * completed booking filter * update * add change in component level and remove unused translations * current time and accepted status logic handler * resize some charts * restore some i18n * restore i18n * restore i18n --------- Co-authored-by: Eunjae Lee <hey@eunjae.dev>
36 lines
965 B
TypeScript
36 lines
965 B
TypeScript
"use client";
|
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { trpc } from "@calcom/trpc";
|
|
|
|
import { useInsightsBookingParameters } from "../../hooks/useInsightsBookingParameters";
|
|
import { ChartCard } from "../ChartCard";
|
|
import { LoadingInsight } from "../LoadingInsights";
|
|
import { UserStatsTable } from "../UserStatsTable";
|
|
|
|
export const MostBookedTeamMembersTable = () => {
|
|
const { t } = useLocale();
|
|
const insightsBookingParams = useInsightsBookingParameters();
|
|
|
|
const { data, isSuccess, isPending } = trpc.viewer.insights.membersWithMostBookings.useQuery(
|
|
insightsBookingParams,
|
|
{
|
|
staleTime: 180000,
|
|
refetchOnWindowFocus: false,
|
|
trpc: {
|
|
context: { skipBatch: true },
|
|
},
|
|
}
|
|
);
|
|
|
|
if (isPending) return <LoadingInsight />;
|
|
|
|
if (!isSuccess || !data) return null;
|
|
|
|
return (
|
|
<ChartCard title={t("most_bookings_scheduled")}>
|
|
<UserStatsTable data={data} />
|
|
</ChartCard>
|
|
);
|
|
};
|