From b32852743456747255df68d0972747d294320ab8 Mon Sep 17 00:00:00 2001 From: alannnc Date: Mon, 22 Aug 2022 13:34:28 -0600 Subject: [PATCH] fix/auto-connect-calendar-3582 (#3891) * Added alert when there isn't default calendar connected * Add default calendar externalId to select placeholder * Fix typos * Fixes prisma import Co-authored-by: Peer Richelsen Co-authored-by: zomars --- .../DestinationCalendarSelector.tsx | 14 ++++- apps/web/pages/auth/login.tsx | 2 +- apps/web/pages/event-types/[type].tsx | 1 + apps/web/pages/event-types/index.tsx | 55 ++++++++++++++++--- apps/web/public/static/locales/en/common.json | 10 ++-- .../routing_forms/playwright/lib/testUtils.ts | 2 +- .../migrations/20220817201039_/migration.sql | 17 ++++++ packages/prisma/schema.prisma | 7 ++- packages/types/AppGetServerSideProps.d.ts | 2 +- 9 files changed, 91 insertions(+), 19 deletions(-) create mode 100644 packages/prisma/migrations/20220817201039_/migration.sql diff --git a/apps/web/components/DestinationCalendarSelector.tsx b/apps/web/components/DestinationCalendarSelector.tsx index 8f3cb539ac..3b917cf023 100644 --- a/apps/web/components/DestinationCalendarSelector.tsx +++ b/apps/web/components/DestinationCalendarSelector.tsx @@ -3,6 +3,7 @@ import React, { useEffect, useState } from "react"; import Select from "react-select"; import { useLocale } from "@calcom/lib/hooks/useLocale"; +import { DestinationCalendar } from "@calcom/prisma/client"; import { trpc } from "@calcom/trpc/react"; interface Props { @@ -11,6 +12,7 @@ interface Props { hidePlaceholder?: boolean; /** The external Id of the connected calendar */ value: string | undefined; + destinationCalendar?: DestinationCalendar | null; } const DestinationCalendarSelector = ({ @@ -18,6 +20,7 @@ const DestinationCalendarSelector = ({ isLoading, value, hidePlaceholder, + destinationCalendar, }: Props): JSX.Element | null => { const { t } = useLocale(); const query = trpc.useQuery(["viewer.connectedCalendars"]); @@ -67,11 +70,20 @@ const DestinationCalendarSelector = ({ value: `${cal.integration}:${cal.externalId}`, })), })) ?? []; + return (