* fix: replace filter implementations on /insights * add authorization for teamIds * replace all the implementations * provide eventTypeId * remove log * fix teamId for isAll * fix Download button * remove legacy implementations * clean up * nullish check * remove unusable filters * revert style * fix type error * fix e2e test * fix type error * fix type error * fix e2e * extract util method * fix type error * fix type error * fix type error --------- Co-authored-by: Benny Joo <sldisek783@gmail.com>
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { Title } from "@tremor/react";
|
|
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { trpc } from "@calcom/trpc";
|
|
|
|
import { useInsightsParameters } from "../hooks/useInsightsParameters";
|
|
import { CardInsights } from "./Card";
|
|
import { LoadingInsight } from "./LoadingInsights";
|
|
import { TotalBookingUsersTable } from "./TotalBookingUsersTable";
|
|
|
|
export const MostBookedTeamMembersTable = () => {
|
|
const { t } = useLocale();
|
|
const { isAll, teamId, startDate, endDate, eventTypeId } = useInsightsParameters();
|
|
|
|
const { data, isSuccess, isPending } = trpc.viewer.insights.membersWithMostBookings.useQuery(
|
|
{
|
|
startDate,
|
|
endDate,
|
|
teamId,
|
|
eventTypeId,
|
|
isAll,
|
|
},
|
|
{
|
|
staleTime: 30000,
|
|
trpc: {
|
|
context: { skipBatch: true },
|
|
},
|
|
}
|
|
);
|
|
|
|
if (isPending) return <LoadingInsight />;
|
|
|
|
if (!isSuccess || !data) return null;
|
|
|
|
return (
|
|
<CardInsights className="shadow-none">
|
|
<Title className="text-emphasis">{t("most_booked_members")}</Title>
|
|
<TotalBookingUsersTable data={data} />
|
|
</CardInsights>
|
|
);
|
|
};
|