31 lines
893 B
TypeScript
31 lines
893 B
TypeScript
|
import { Card, Title } from "@tremor/react";
|
||
|
|
||
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||
|
import { trpc } from "@calcom/trpc";
|
||
|
|
||
|
import { useFilterContext } from "../context/provider";
|
||
|
import { TotalBookingUsersTable } from "./TotalBookingUsersTable";
|
||
|
|
||
|
export const LeastBookedTeamMembersTable = () => {
|
||
|
const { t } = useLocale();
|
||
|
const { filter } = useFilterContext();
|
||
|
const { dateRange } = filter;
|
||
|
const [startDate, endDate] = dateRange;
|
||
|
const { selectedTeamId: teamId } = filter;
|
||
|
|
||
|
const { data, isSuccess } = trpc.viewer.insights.membersWithLeastBookings.useQuery({
|
||
|
startDate: startDate.toISOString(),
|
||
|
endDate: endDate.toISOString(),
|
||
|
teamId,
|
||
|
});
|
||
|
|
||
|
if (!isSuccess || !startDate || !endDate || !teamId) return null;
|
||
|
|
||
|
return (
|
||
|
<Card>
|
||
|
<Title>{t("least_booked_members")}</Title>
|
||
|
<TotalBookingUsersTable data={data} />
|
||
|
</Card>
|
||
|
);
|
||
|
};
|