From 2faf7e680695ff1d2fe954072339723f9a032846 Mon Sep 17 00:00:00 2001 From: alannnc Date: Sun, 12 Jun 2022 09:19:35 -0600 Subject: [PATCH] Fix onboarding calendar connection (#3036) --- .../integrations/CalendarListContainer.tsx | 88 +++++++++++++++---- apps/web/pages/getting-started.tsx | 2 +- 2 files changed, 71 insertions(+), 19 deletions(-) diff --git a/apps/web/components/integrations/CalendarListContainer.tsx b/apps/web/components/integrations/CalendarListContainer.tsx index 43d181ecdb..7f32fd1b71 100644 --- a/apps/web/components/integrations/CalendarListContainer.tsx +++ b/apps/web/components/integrations/CalendarListContainer.tsx @@ -1,6 +1,7 @@ import { Fragment } from "react"; import { useMutation } from "react-query"; +import { InstallAppButton } from "@calcom/app-store/components"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import showToast from "@calcom/lib/notification"; import { Alert } from "@calcom/ui/Alert"; @@ -22,6 +23,7 @@ import SubHeadingTitleWithConnections from "./SubHeadingTitleWithConnections"; type Props = { onChanged: () => unknown | Promise; + fromOnboarding?: boolean; }; function CalendarSwitch(props: { @@ -93,10 +95,44 @@ function CalendarSwitch(props: { ); } +function CalendarList(props: Props) { + const { t } = useLocale(); + const query = trpc.useQuery(["viewer.integrations", { variant: "calendar", onlyInstalled: false }]); + + return ( + ( + + {data.items.map((item) => ( + ( + + )} + onChanged={() => props.onChanged()} + /> + } + /> + ))} + + )} + /> + ); +} + function ConnectedCalendarsList(props: Props) { const { t } = useLocale(); const query = trpc.useQuery(["viewer.connectedCalendars"], { suspense: true }); - + const { fromOnboarding } = props; return ( }> -

- Toggle the calendar(s) you want to check for conflicts to prevent double bookings. -

-
    - {item.calendars.map((cal) => ( - - ))} -
+ {!fromOnboarding && ( + <> +

+ Toggle the calendar(s) you want to check for conflicts to prevent double bookings. +

+
    + {item.calendars.map((cal) => ( + + ))} +
+ + )} ) : ( Promise.allSettled([ @@ -210,6 +250,7 @@ export function CalendarListContainer(props: { heading?: false }) { value={data.destinationCalendar?.externalId} /> + {!!data.connectedCalendars.length && (
@@ -219,7 +260,18 @@ export function CalendarListContainer(props: { heading?: false }) { } /> )} - + + + )} + {fromOnboarding && ( + <> + {!!query.data?.connectedCalendars.length && ( + } + /> + )} + )} diff --git a/apps/web/pages/getting-started.tsx b/apps/web/pages/getting-started.tsx index 809d37a10b..43c579f8d1 100644 --- a/apps/web/pages/getting-started.tsx +++ b/apps/web/pages/getting-started.tsx @@ -429,7 +429,7 @@ export default function Onboarding(props: inferSSRProps}> - + ), hideConfirm: true,