* migrate router * createTRPCReact * frontend 1 * random format change * frontend 2 * withQuery * form router * TS-ERROR: proxy on utils-client * inferance * ssg * reuse * trpc rc4 * Apply suggestions from code review * skip test * move skip one level up * whops * rc 6 with new setData func Co-authored-by: zomars <zomars@me.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { RouterInputs, trpc } from "@calcom/trpc/react";
|
|
|
|
import DestinationCalendarSelector from "@components/DestinationCalendarSelector";
|
|
|
|
interface ICreateEventsOnCalendarSelectProps {
|
|
calendar?: RouterInputs["viewer"]["setDestinationCalendar"] | null;
|
|
}
|
|
|
|
const CreateEventsOnCalendarSelect = (props: ICreateEventsOnCalendarSelectProps) => {
|
|
const { calendar } = props;
|
|
const { t } = useLocale();
|
|
const mutation = trpc.viewer.setDestinationCalendar.useMutation();
|
|
|
|
return (
|
|
<>
|
|
<div className="mt-6 flex flex-row">
|
|
<div className="w-full">
|
|
<label htmlFor="createEventsOn" className="flex text-sm font-medium text-neutral-700">
|
|
{t("create_events_on")}
|
|
</label>
|
|
<div className="mt-2">
|
|
<DestinationCalendarSelector
|
|
value={calendar ? calendar.externalId : undefined}
|
|
onChange={(calendar) => {
|
|
mutation.mutate(calendar);
|
|
}}
|
|
hidePlaceholder
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export { CreateEventsOnCalendarSelect };
|