From 61eb439fa0fcb149e854ca25d368865e74e30896 Mon Sep 17 00:00:00 2001 From: Sean Brydon Date: Thu, 26 Oct 2023 09:08:07 +0100 Subject: [PATCH] useschedule --- .../troubleshooter/components/LargeCalendar.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/features/troubleshooter/components/LargeCalendar.tsx b/packages/features/troubleshooter/components/LargeCalendar.tsx index dc43ac879c..df66ada603 100644 --- a/packages/features/troubleshooter/components/LargeCalendar.tsx +++ b/packages/features/troubleshooter/components/LargeCalendar.tsx @@ -3,6 +3,7 @@ import { useMemo } from "react"; import dayjs from "@calcom/dayjs"; import { Calendar } from "@calcom/features/calendars/weeklyview"; +import { BookingStatus } from "@calcom/prisma/enums"; import { trpc } from "@calcom/trpc/react"; import { useTroubleshooterStore } from "../store"; @@ -12,6 +13,14 @@ export const LargeCalendar = ({ extraDays }: { extraDays: number }) => { const { data: session } = useSession(); const date = selectedDate ? dayjs(selectedDate) : dayjs(); + const { data: schedule } = useSchedule({ + username: session?.user.username || "", + eventSlug: eventSlug, + eventId: event.data?.id ?? eventId, + monthCount, + rescheduleUid, + }); + const { data, isLoading } = trpc.viewer.availability.user.useQuery( { username: session?.user?.username || "", @@ -30,17 +39,15 @@ export const LargeCalendar = ({ extraDays }: { extraDays: number }) => { const events = useMemo(() => { if (!data?.busy) return []; - return data?.busy.map((event) => { - const id = typeof event.start === "string" ? event.start : event.start.toISOString(); - + return data?.busy.map((event, idx) => { return { - id, + id: idx, title: event.title ?? "Busy", start: new Date(event.start), end: new Date(event.end), options: { borderColor: "#F97417", - status: "ACCEPTED", + status: BookingStatus.ACCEPTED, }, }; });