V1->V2 connect calendar (#3961)
* V1->V2 connect calendar * Fix imports * Fix types * Implementing v1 NoCalendarConnectedAlert changes on v2 component Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Alan <[email protected]>
This commit is contained in:
2 files changed
+17
-1
No files matched your search
@@ -2,6 +2,7 @@ import classNames from "classnames";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { DestinationCalendar } from "@calcom/prisma/client";
|
||||
import { trpc } from "@calcom/trpc/react";
|
||||
import Select from "@calcom/ui/v2/core/form/Select";
|
||||
|
||||
@@ -10,6 +11,7 @@ interface Props {
|
||||
isLoading?: boolean;
|
||||
hidePlaceholder?: boolean;
|
||||
/** The external Id of the connected calendar */
|
||||
destinationCalendar?: DestinationCalendar | null;
|
||||
value: string | undefined;
|
||||
maxWidth?: number;
|
||||
}
|
||||
@@ -20,6 +22,7 @@ const DestinationCalendarSelector = ({
|
||||
value,
|
||||
hidePlaceholder,
|
||||
maxWidth,
|
||||
destinationCalendar,
|
||||
}: Props): JSX.Element | null => {
|
||||
const { t } = useLocale();
|
||||
const query = trpc.useQuery(["viewer.connectedCalendars"]);
|
||||
@@ -73,7 +76,15 @@ const DestinationCalendarSelector = ({
|
||||
<div className="relative" title={`${t("select_destination_calendar")}: ${selectedOption?.label || ""}`}>
|
||||
<Select
|
||||
name="primarySelectedCalendar"
|
||||
placeholder={!hidePlaceholder ? `${t("select_destination_calendar")}:` : undefined}
|
||||
placeholder={
|
||||
!hidePlaceholder ? (
|
||||
`${t("select_destination_calendar")}`
|
||||
) : (
|
||||
<span>
|
||||
{t("default_calendar_selected")} ({destinationCalendar?.externalId})
|
||||
</span>
|
||||
)
|
||||
}
|
||||
options={options}
|
||||
styles={{
|
||||
placeholder: (styles) => ({ ...styles, ...content(hidePlaceholder) }),
|
||||
|
||||
Reference in new issue
Block a user