## What does this PR do? <!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. --> - Add the prop customDividerClassName to customize the CSS Divider if needed - Add a divider on all modals with type="creation" prop, following the [figma](https://www.figma.com/file/9MOufQNLtdkpnDucmNX10R/1.-Cal-DS?type=design&node-id=29898%3A100590&t=62LvZCZAEZm5zDdw-1) design - Some type="creation" modals seem not to be this type, we pushed all changes with screenshots, if you want us to revert the changes on some modals we will revert  - Inline Embed:  - Enable Two-Factor Authentication:  -Enable Two-Factor Authentication (step 2):  -Enable Two-Factor Authentication (step 3):  - Disable Two-Factor Authentication:  - Delete Account:  - Update Timezone:  - Duplicate Event Type:  - Add a New Form:  - Change Team Member Role:  - Impersonate:  - Bulk Update Event Types:  - Connecting with MS Teams:  - Set a Default App Link:  - OIDC configuration:  - SAML Configuration:  - How to use booking questions as variables?   - Invite Link Settings:  - Add Action:  - Edit Keys:  - Create an Api Key:  - API key created successfully:  - Invite Team Member:  - Add a Question:  - Add a new event type: 
91 lines
2.5 KiB
TypeScript
91 lines
2.5 KiB
TypeScript
import { zodResolver } from "@hookform/resolvers/zod";
|
|
import type { Dispatch, SetStateAction } from "react";
|
|
import { useForm } from "react-hook-form";
|
|
import { z } from "zod";
|
|
|
|
import type { EventLocationType } from "@calcom/app-store/locations";
|
|
import { getEventLocationType } from "@calcom/app-store/locations";
|
|
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
|
import { trpc } from "@calcom/trpc/react";
|
|
import {
|
|
showToast,
|
|
Dialog,
|
|
DialogContent,
|
|
Form,
|
|
TextField,
|
|
DialogFooter,
|
|
Button,
|
|
DialogClose,
|
|
} from "@calcom/ui";
|
|
import { AlertCircle } from "@calcom/ui/components/icon";
|
|
|
|
type LocationTypeSetLinkDialogFormProps = {
|
|
link?: string;
|
|
type: EventLocationType["type"];
|
|
};
|
|
|
|
export function AppSetDefaultLinkDialog({
|
|
locationType,
|
|
setLocationType,
|
|
onSuccess,
|
|
}: {
|
|
locationType: EventLocationType & { slug: string };
|
|
setLocationType: Dispatch<SetStateAction<(EventLocationType & { slug: string }) | undefined>>;
|
|
onSuccess: () => void;
|
|
}) {
|
|
const { t } = useLocale();
|
|
const eventLocationTypeOptions = getEventLocationType(locationType.type);
|
|
|
|
const form = useForm<LocationTypeSetLinkDialogFormProps>({
|
|
resolver: zodResolver(
|
|
z.object({ link: z.string().regex(new RegExp(eventLocationTypeOptions?.urlRegExp ?? "")) })
|
|
),
|
|
});
|
|
|
|
const updateDefaultAppMutation = trpc.viewer.updateUserDefaultConferencingApp.useMutation({
|
|
onSuccess: () => {
|
|
onSuccess();
|
|
},
|
|
onError: () => {
|
|
showToast(`Invalid App Link Format`, "error");
|
|
},
|
|
});
|
|
|
|
return (
|
|
<Dialog open={!!locationType} onOpenChange={() => setLocationType(undefined)}>
|
|
<DialogContent
|
|
title={t("default_app_link_title")}
|
|
description={t("default_app_link_description")}
|
|
type="creation"
|
|
Icon={AlertCircle}>
|
|
<Form
|
|
form={form}
|
|
handleSubmit={(values) => {
|
|
updateDefaultAppMutation.mutate({
|
|
appSlug: locationType.slug,
|
|
appLink: values.link,
|
|
});
|
|
setLocationType(undefined);
|
|
}}>
|
|
<>
|
|
<TextField
|
|
type="text"
|
|
required
|
|
{...form.register("link")}
|
|
placeholder={locationType.organizerInputPlaceholder ?? ""}
|
|
label={locationType.label ?? ""}
|
|
/>
|
|
|
|
<DialogFooter showDivider className="mt-8">
|
|
<DialogClose />
|
|
<Button color="primary" type="submit">
|
|
{t("save")}
|
|
</Button>
|
|
</DialogFooter>
|
|
</>
|
|
</Form>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|