* perf: Slim down loggedInViewer some more * Move locationOptions to apps router * Moved calVideo related handlers to separate router * Moved calendar related handlers to separate router * Rename * Moved deleteCredential to new router * Moved updateProfile to me router * fix unit test * fix e2e test * tweak * missing --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com> Co-authored-by: unknown <adhabal2002@gmail.com>
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import DestinationCalendarSelector from "@calcom/features/calendars/DestinationCalendarSelector";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import type { RouterInputs } from "@calcom/trpc/react";
|
|
import { trpc } from "@calcom/trpc/react";
|
|
|
|
interface ICreateEventsOnCalendarSelectProps {
|
|
calendar?: RouterInputs["viewer"]["calendars"]["setDestinationCalendar"] | null;
|
|
}
|
|
|
|
const CreateEventsOnCalendarSelect = (props: ICreateEventsOnCalendarSelectProps) => {
|
|
const { calendar } = props;
|
|
const { t } = useLocale();
|
|
const mutation = trpc.viewer.calendars.setDestinationCalendar.useMutation();
|
|
const connectedCalendarsQuery = trpc.viewer.calendars.connectedCalendars.useQuery();
|
|
|
|
return (
|
|
<>
|
|
<div className="mt-6 flex flex-row">
|
|
<div className="w-full">
|
|
<label htmlFor="createEventsOn" className="text-default flex text-sm font-medium">
|
|
{t("create_events_on")}
|
|
</label>
|
|
<div className="mt-2">
|
|
<DestinationCalendarSelector
|
|
value={calendar ? calendar.externalId : undefined}
|
|
onChange={(calendar) => {
|
|
mutation.mutate(calendar);
|
|
}}
|
|
hidePlaceholder
|
|
calendarsQueryData={connectedCalendarsQuery.data}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export { CreateEventsOnCalendarSelect };
|