feat: Add divider and set spacing on modals with the type=creation prop (feat-add-divider)

## 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

![image](https://github.com/calcom/cal.com/assets/121884634/6674016e-819d-49da-9d44-14eefb4160ee)


- Inline Embed: 
![image](https://github.com/calcom/cal.com/assets/121884634/191c94ea-257f-44ba-8c7a-3815550e36f1)

- Enable Two-Factor Authentication:
![image](https://github.com/calcom/cal.com/assets/121884634/3b9246be-52ab-4c9d-af12-eda82541e837)

-Enable Two-Factor Authentication (step 2):
![image](https://github.com/calcom/cal.com/assets/121884634/a3b7934b-fd66-441d-b9d7-c5ba2fc7fa91)

-Enable Two-Factor Authentication (step 3):
![image](https://github.com/calcom/cal.com/assets/121884634/77367ae7-0967-497a-858a-f18a91b62077)

- Disable Two-Factor Authentication:
![image](https://github.com/calcom/cal.com/assets/121884634/8fc31cc2-e3ca-4c74-8ac6-c4832f9116d9)

- Delete Account:
![image](https://github.com/calcom/cal.com/assets/121884634/5146f605-523e-4c49-aeeb-7c5dd533844d)

- Update Timezone:
![image](https://github.com/calcom/cal.com/assets/121884634/f5acb9f0-2550-4d48-8c02-5cf1b94aaf33)

- Duplicate Event Type:
![image](https://github.com/calcom/cal.com/assets/121884634/078d40a5-5e35-4d4a-8d0e-77d7b8c21d6d)

- Add a New Form:
![image](https://github.com/calcom/cal.com/assets/121884634/5b6352e0-a1c1-46e3-af18-dc84e83fdecd)

- Change Team Member Role:
![image](https://github.com/calcom/cal.com/assets/121884634/dc8b8ba1-7986-4980-ab78-6027aca350ca)

- Impersonate:
![image](https://github.com/calcom/cal.com/assets/121884634/ffd28b83-0c9b-47a1-8894-29d35add9c27)

- Bulk Update Event Types:
![image](https://github.com/calcom/cal.com/assets/121884634/ba864dcc-0c73-426e-bc49-3ac81a55d3ea)

- Connecting with MS Teams:
![image](https://github.com/calcom/cal.com/assets/121884634/d6666cbf-cc36-4fe5-90bb-9d69de26248d)

- Set a Default App Link:
![image](https://github.com/calcom/cal.com/assets/121884634/f4f7093c-839c-4ae1-a4f3-ecd266238115)

- OIDC configuration:
![image](https://github.com/calcom/cal.com/assets/121884634/a689acd7-2488-423e-a57d-5610d683d11d)

- SAML Configuration:
![image](https://github.com/calcom/cal.com/assets/121884634/61480037-1733-4ba9-8dfd-429819e7eac9)

- How to use booking questions as variables?
![image](https://github.com/calcom/cal.com/assets/121884634/2982ace4-41b0-4849-878b-b2ceabf59469)
![image](https://github.com/calcom/cal.com/assets/121884634/65888a13-d9a7-4df5-a8b7-56becc61882e)

- Invite Link Settings:
![image](https://github.com/calcom/cal.com/assets/121884634/3f81fcd1-f862-4106-a79c-70808090f055)

- Add Action:
![image](https://github.com/calcom/cal.com/assets/121884634/ec5f9490-dccc-4c8e-bc8e-b48f8a29144b)

- Edit Keys:
![245192220-c669e6fe-01ba-4a66-9b03-96ab4e8f1809](https://github.com/calcom/cal.com/assets/121884634/bfff69b3-831a-4a5c-9835-0569109b8386)

- Create an Api Key:
![image](https://github.com/calcom/cal.com/assets/121884634/fbdf7494-6da4-49da-ba41-5f9a6393bb72)

- API key created successfully:
![image](https://github.com/calcom/cal.com/assets/121884634/81e6a5c2-5d9d-40ad-a78e-ed1ab2128a26)

- Invite Team Member:
![image](https://github.com/calcom/cal.com/assets/121884634/9e4ceea9-f708-4958-a6d7-e00304beacbf)

- Add a Question:
![image](https://github.com/calcom/cal.com/assets/121884634/8329c593-8203-484e-a4dd-c9bd5210d8db)

- Add a new event type:
![image](https://github.com/calcom/cal.com/assets/121884634/19a72734-aa79-4828-81bb-f534d46a5fc5)
This commit is contained in:
GitStart-Cal.com authored and GitHub committed 2023-06-29 08:47:16 +01:00
1 parent 5059723ad1
commit e731c33235
26 files changed
+258 -237

No files matched your search

+8 -4
View File
@@ -17,6 +17,7 @@ import {
Button,
Dialog,
DialogClose,
DialogFooter,
DialogContent,
HorizontalTabs,
Label,
@@ -1206,8 +1207,12 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
/>
)}
</div>
<div className={router.query.embedTabName == "embed-preview" ? "block" : "hidden"} />
<div className="mt-8 flex flex-row-reverse gap-x-2">
<div className={router.query.embedTabName == "embed-preview" ? "mt-2 block" : "hidden"} />
<DialogFooter
className="mt-10 flex flex-row-reverse gap-x-2"
showDivider
customDividerClassNames="w-2/3">
<DialogClose />
{tab.type === "code" ? (
<Button
type="submit"
@@ -1222,8 +1227,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
{t("copy_code")}
</Button>
) : null}
<DialogClose />
</div>
</DialogFooter>
</div>
);
})}
@@ -3,7 +3,7 @@ import { useForm } from "react-hook-form";
import { ErrorCode } from "@calcom/features/auth/lib/ErrorCode";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Button, Dialog, DialogContent, Form, PasswordField } from "@calcom/ui";
import { Button, Dialog, DialogContent, DialogFooter, Form, PasswordField } from "@calcom/ui";
import TwoFactor from "@components/auth/TwoFactor";
@@ -74,7 +74,7 @@ const DisableTwoFactorAuthModal = ({
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent title={t("disable_2fa")} description={t("disable_2fa_recommendation")} type="creation">
<Form form={form} handleSubmit={handleDisable}>
<div className="mb-4">
<div className="mb-8">
<PasswordField
labelProps={{
className: "block text-sm font-medium text-default",
@@ -87,14 +87,14 @@ const DisableTwoFactorAuthModal = ({
{errorMessage && <p className="mt-1 text-sm text-red-700">{errorMessage}</p>}
</div>
<div className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
<Button type="submit" className="me-2 ms-2" data-testid="disable-2fa" disabled={isDisabling}>
{t("disable")}
</Button>
<DialogFooter showDivider className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
<Button color="secondary" onClick={onCancel}>
{t("cancel")}
</Button>
</div>
<Button type="submit" className="me-2 ms-2" data-testid="disable-2fa" disabled={isDisabling}>
{t("disable")}
</Button>
</DialogFooter>
</Form>
</DialogContent>
</Dialog>
@@ -4,7 +4,7 @@ import { useForm } from "react-hook-form";
import { ErrorCode } from "@calcom/features/auth/lib/ErrorCode";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Button, Dialog, DialogContent, Form, TextField } from "@calcom/ui";
import { Button, Dialog, DialogContent, DialogFooter, Form, TextField } from "@calcom/ui";
import TwoFactor from "@components/auth/TwoFactor";
@@ -150,20 +150,20 @@ const EnableTwoFactorModal = ({ onEnable, onCancel, open, onOpenChange }: Enable
</WithStep>
<WithStep step={SetupStep.DisplayQrCode} current={step}>
<>
<div className="flex justify-center">
<div className="-mt-3 flex justify-center">
{
// eslint-disable-next-line @next/next/no-img-element
<img src={dataUri} alt="" />
}
</div>
<p data-testid="two-factor-secret" className="text-center font-mono text-xs">
<p data-testid="two-factor-secret" className="mb-4 text-center font-mono text-xs">
{secret}
</p>
</>
</WithStep>
<Form handleSubmit={handleEnable} form={form}>
<WithStep step={SetupStep.EnterTotpCode} current={step}>
<div className="mb-4">
<div className="-mt-4 pb-2">
<TwoFactor center />
{errorMessage && (
@@ -173,7 +173,10 @@ const EnableTwoFactorModal = ({ onEnable, onCancel, open, onOpenChange }: Enable
)}
</div>
</WithStep>
<div className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
<DialogFooter className="mt-8 sm:flex sm:flex-row-reverse" showDivider>
<Button color="secondary" onClick={onCancel}>
{t("cancel")}
</Button>
<WithStep step={SetupStep.ConfirmPassword} current={step}>
<Button
type="submit"
@@ -197,10 +200,7 @@ const EnableTwoFactorModal = ({ onEnable, onCancel, open, onOpenChange }: Enable
{t("enable")}
</Button>
</WithStep>
<Button color="secondary" onClick={onCancel}>
{t("cancel")}
</Button>
</div>
</DialogFooter>
</Form>
</DialogContent>
</Dialog>
+32 -30
View File
@@ -243,36 +243,38 @@ const ProfileView = () => {
type="creation"
Icon={AlertTriangle}>
<>
<p className="text-default mb-7">
{t("delete_account_confirmation_message", { appName: APP_NAME })}
</p>
{isCALIdentityProviver && (
<PasswordField
data-testid="password"
name="password"
id="password"
autoComplete="current-password"
required
label="Password"
ref={passwordRef}
/>
)}
<div className="mb-10">
<p className="text-default mb-4">
{t("delete_account_confirmation_message", { appName: APP_NAME })}
</p>
{isCALIdentityProviver && (
<PasswordField
data-testid="password"
name="password"
id="password"
autoComplete="current-password"
required
label="Password"
ref={passwordRef}
/>
)}
{user?.twoFactorEnabled && isCALIdentityProviver && (
<Form handleSubmit={onConfirm} className="pb-4" form={form}>
<TwoFactor center={false} />
</Form>
)}
{user?.twoFactorEnabled && isCALIdentityProviver && (
<Form handleSubmit={onConfirm} className="pb-4" form={form}>
<TwoFactor center={false} />
</Form>
)}
{hasDeleteErrors && <Alert severity="error" title={deleteErrorMessage} />}
<DialogFooter>
{hasDeleteErrors && <Alert severity="error" title={deleteErrorMessage} />}
</div>
<DialogFooter showDivider>
<DialogClose />
<Button
color="primary"
data-testid="delete-account-confirm"
onClick={(e) => onConfirmButton(e)}>
{t("delete_my_account")}
</Button>
<DialogClose />
</DialogFooter>
</>
</DialogContent>
@@ -285,7 +287,7 @@ const ProfileView = () => {
description={t("confirm_password_change_email")}
type="creation"
Icon={AlertTriangle}>
<>
<div className="mb-10">
<PasswordField
data-testid="password"
name="password"
@@ -297,13 +299,13 @@ const ProfileView = () => {
/>
{confirmPasswordErrorMessage && <Alert severity="error" title={confirmPasswordErrorMessage} />}
<DialogFooter>
<Button color="primary" onClick={(e) => onConfirmPassword(e)}>
{t("confirm")}
</Button>
<DialogClose />
</DialogFooter>
</>
</div>
<DialogFooter showDivider>
<Button color="primary" onClick={(e) => onConfirmPassword(e)}>
{t("confirm")}
</Button>
<DialogClose />
</DialogFooter>
</DialogContent>
</Dialog>
</>
@@ -12,7 +12,7 @@ export function AccountDialog(props: DialogProps) {
type="creation"
title="Connecting with MS Teams requires a work/school Microsoft account."
description="If you continue with a personal account you will receive an error">
<DialogFooter>
<DialogFooter showDivider className="mt-6">
<>
<DialogClose
type="button"
@@ -18,6 +18,7 @@ import {
Dialog,
DialogClose,
DialogContent,
DialogFooter,
Dropdown,
DropdownMenuContent,
DropdownMenuItem,
@@ -91,8 +92,10 @@ function NewFormDialog({ appUrl }: { appUrl: string }) {
return (
<Dialog name="new-form" clearQueryParamsOnClose={["target", "action"]}>
<DialogContent className="overflow-y-auto">
<div className="mb-4">
<h3 className="text-emphasis text-lg font-bold leading-6" id="modal-title">
<div className="mb-1">
<h3
className="text-emphasis !font-cal text-semibold leading-20 text-xl font-medium"
id="modal-title">
{teamId ? t("add_new_team_form") : t("add_new_form")}
</h3>
<div>
@@ -112,7 +115,7 @@ function NewFormDialog({ appUrl }: { appUrl: string }) {
duplicateFrom: formToDuplicate,
});
}}>
<div className="mt-3 space-y-4">
<div className="mt-3 space-y-5">
<TextField label={t("title")} required placeholder={t("a_routing_form")} {...register("name")} />
<div className="mb-5">
<TextAreaField
@@ -141,12 +144,12 @@ function NewFormDialog({ appUrl }: { appUrl: string }) {
/>
)}
</div>
<div className="mt-8 flex flex-row-reverse gap-x-2">
<DialogFooter showDivider className="mt-12 flex flex-row-reverse gap-x-2">
<DialogClose />
<Button loading={mutation.isLoading} data-testid="add-form" type="submit">
{t("continue")}
</Button>
<DialogClose />
</div>
</DialogFooter>
</Form>
</DialogContent>
</Dialog>
+1 -1
View File
@@ -244,7 +244,7 @@ const EditKeysModal: FC<{
))}
</Form>
)}
<DialogFooter>
<DialogFooter showDivider className="mt-8">
<DialogClose onClick={handleModelClose} />
<Button form="edit-keys" type="submit">
{t("save")}
@@ -76,11 +76,11 @@ export function AppSetDefaultLinkDialog({
label={locationType.label ?? ""}
/>
<DialogFooter>
<DialogFooter showDivider className="mt-8">
<DialogClose />
<Button color="primary" type="submit">
{t("save")}
</Button>
<DialogClose />
</DialogFooter>
</>
</Form>
@@ -46,11 +46,11 @@ export const EventOccurences = ({ event }: { event: PublicEvent }) => {
))}
{recurringStrings.length > 5 && (
<Tooltip
content={recurringStrings.slice(5).map((timeFormatted, key) => (
<p key={key}>{timeFormatted}</p>
))}>
<p className=" text-sm">+ {t("plus_more", { count: recurringStrings.length - 5 })}</p>
</Tooltip>
content={recurringStrings.slice(5).map((timeFormatted, key) => (
<p key={key}>{timeFormatted}</p>
))}>
<p className=" text-sm">+ {t("plus_more", { count: recurringStrings.length - 5 })}</p>
</Tooltip>
)}
</>
);
@@ -62,7 +62,7 @@ export function Calendar(props: CalendarComponentProps) {
<DateValues containerNavRef={containerNav} days={days} />
<div className="relative flex flex-auto">
<CurrentTime />
<div className="bg-default dark:bg-muted ring-muted sticky border-default border-l border-r left-0 z-10 w-14 flex-none ring-1" />
<div className="bg-default dark:bg-muted ring-muted border-default sticky left-0 z-10 w-14 flex-none border-l border-r ring-1" />
<div
className="grid flex-auto grid-cols-1 grid-rows-1 [--disabled-gradient-background:#F8F9FB] [--disabled-gradient-foreground:#E6E7EB] dark:[--disabled-gradient-background:#262626] dark:[--disabled-gradient-foreground:#393939]"
style={{
@@ -34,7 +34,7 @@ export function DateValues({ days, containerNavRef }: Props) {
})}
</div>
<div className="text-subtle -mr-px hidden auto-cols-fr text-sm leading-6 sm:flex ">
<div className="col-end-1 w-14 border-default border-l" />
<div className="border-default col-end-1 w-14 border-l" />
{days.map((day) => {
const isToday = dayjs().isSame(day, "day");
return (
@@ -51,7 +51,7 @@ export default function ApiKeyDialogForm({
<LicenseRequired>
{successfulNewApiKeyModal ? (
<>
<div className="mb-10">
<div className="mb-6">
<h2 className="font-semi-bold font-cal text-emphasis mb-2 text-xl tracking-wide">
{t("success_api_key_created")}
</h2>
@@ -62,7 +62,7 @@ export default function ApiKeyDialogForm({
</div>
<div>
<div className="flex">
<code className="bg-subtle text-default mb-2 w-full truncate rounded-md rounded-r-none py-[6px] pl-2 pr-2 align-middle font-mono">
<code className="bg-subtle text-default w-full truncate rounded-md rounded-r-none py-[6px] pl-2 pr-2 align-middle font-mono">
{" "}
{apiKey}
</code>
@@ -85,7 +85,7 @@ export default function ApiKeyDialogForm({
: `${t("expires")} ${apiKeyDetails?.expiresAt?.toLocaleDateString()}`}
</span>
</div>
<DialogFooter>
<DialogFooter showDivider className="!mt-12">
<Button type="button" color="secondary" onClick={handleClose} tabIndex={-1}>
{t("done")}
</Button>
@@ -107,7 +107,7 @@ export default function ApiKeyDialogForm({
}
}}
className="space-y-4">
<div className="mb-10 mt-1">
<div className="mt-1 mb-4">
<h2 className="font-semi-bold font-cal text-emphasis text-xl tracking-wide">
{defaultValues ? t("edit_api_key") : t("create_api_key")}
</h2>
@@ -162,7 +162,7 @@ export default function ApiKeyDialogForm({
</div>
)}
<DialogFooter>
<DialogFooter showDivider className="!mt-12">
<Button type="button" color="secondary" onClick={handleClose} tabIndex={-1}>
{t("cancel")}
</Button>
@@ -88,12 +88,10 @@ const CreateConnectionDialog = ({
wellKnownUrl,
});
}}>
<div className="mb-10 mt-1">
<h2 className="font-semi-bold font-cal text-emphasis text-xl tracking-wide">
{t("sso_oidc_configuration_title")}
</h2>
<p className="text-subtle mb-5 mt-1 text-sm">{t("sso_oidc_configuration_description")}</p>
</div>
<h2 className="font-semi-bold font-cal text-emphasis text-xl tracking-wide">
{t("sso_oidc_configuration_title")}
</h2>
<p className="text-subtle mt-1 mb-4 text-sm">{t("sso_oidc_configuration_description")}</p>
<div className="space-y-5">
<Controller
control={form.control}
@@ -144,7 +142,7 @@ const CreateConnectionDialog = ({
)}
/>
</div>
<DialogFooter>
<DialogFooter showDivider className="mt-10">
<Button
type="button"
color="secondary"
@@ -82,7 +82,7 @@ const CreateConnectionDialog = ({
encodedRawMetadata: Buffer.from(values.metadata).toString("base64"),
});
}}>
<div className="mb-10 mt-1">
<div className="mb-1">
<h2 className="font-semi-bold font-cal text-emphasis text-xl tracking-wide">
{t("sso_saml_configuration_title")}
</h2>
@@ -107,7 +107,7 @@ const CreateConnectionDialog = ({
</div>
)}
/>
<DialogFooter>
<DialogFooter showDivider className="mt-10">
<Button
type="button"
color="secondary"
@@ -75,7 +75,7 @@ export default function InviteLinkSettingsModal(props: InvitationLinkSettingsMod
name="expiresInDays"
control={linkSettingsFormMethods.control}
render={({ field: { onChange } }) => (
<div>
<div className="-mt-2">
<Label className="text-emphasis font-medium" htmlFor="expiresInDays">
{t("link_expires_after")}
</Label>
@@ -88,7 +88,7 @@ export default function InviteLinkSettingsModal(props: InvitationLinkSettingsMod
</div>
)}
/>
<DialogFooter>
<DialogFooter showDivider className="mt-10">
<Button
type="button"
color="secondary"
@@ -4,7 +4,7 @@ import { useMemo, useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { MembershipRole } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
import { Button, Dialog, DialogContent, Select } from "@calcom/ui";
import { Button, Dialog, DialogContent, DialogFooter, Select } from "@calcom/ui";
type MembershipRoleOption = {
label: string;
@@ -74,7 +74,9 @@ export default function MemberChangeRoleModal(props: {
<>
<div className="mb-4 sm:flex sm:items-start">
<div className="text-center sm:text-left">
<h3 className="text-emphasis text-lg font-medium leading-6" id="modal-title">
<h3
className="text-emphasis !font-cal text-semibold leading-20 text-xl font-medium"
id="modal-title">
{t("change_member_role")}
</h3>
</div>
@@ -100,14 +102,14 @@ export default function MemberChangeRoleModal(props: {
{errorMessage}
</p>
)}
<div className="mt-5 sm:mt-4 sm:flex sm:flex-row-reverse">
<Button type="submit" color="primary" className="me-2 ms-2">
{t("save")}
</Button>
<DialogFooter showDivider className="mt-12 sm:flex sm:flex-row-reverse">
<Button type="button" color="secondary" onClick={props.onExit}>
{t("cancel")}
</Button>
</div>
<Button type="submit" color="primary" className="me-2 ms-2">
{t("save")}
</Button>
</DialogFooter>
</form>
</>
</DialogContent>
@@ -165,7 +165,7 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
</div>
<Form form={newMemberFormMethods} handleSubmit={(values) => props.onSubmit(values, resetFields)}>
<div className="mb-10 mt-6 space-y-6">
<div className="mb-12 mt-6 space-y-6">
{/* Indivdual Invite */}
{modalImportMode === "INDIVIDUAL" && (
<Controller
@@ -282,8 +282,8 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
/>
)}
/>
{props.token && (
<div className="flex">
{props.token && (
<Button
type="button"
color="minimal"
@@ -295,8 +295,8 @@ export default function MemberInvitationModal(props: MemberInvitationModalProps)
data-testid="edit-invite-link-button">
{t("edit_invite_link")}
</Button>
)}
</div>
</div>
)}
</div>
<DialogFooter showDivider>
<div className="flex w-full flex-col items-end gap-2 md:flex-row md:items-center md:justify-between">
@@ -289,7 +289,7 @@ export default function MemberListItem(props: Props) {
});
setShowImpersonateModal(false);
}}>
<DialogFooter>
<DialogFooter showDivider className="mt-8">
<DialogClose color="secondary">{t("cancel")}</DialogClose>
<Button color="primary" type="submit">
{t("impersonate")}
@@ -119,138 +119,131 @@ export const AddActionDialog = (props: IAddActionDialog) => {
return (
<Dialog open={isOpenDialog} onOpenChange={setIsOpenDialog}>
<DialogContent type="creation" title={t("add_action")}>
<div className="space-x-3 ">
<div className="pt-1">
<Form
form={form}
handleSubmit={(values) => {
addAction(
values.action,
values.sendTo,
values.numberRequired,
values.senderId,
values.senderName
);
form.unregister("sendTo");
form.unregister("action");
form.unregister("numberRequired");
setIsOpenDialog(false);
setIsPhoneNumberNeeded(false);
setIsEmailAddressNeeded(false);
setIsSenderIdNeeded(false);
}}>
<div className="-mt-3 space-x-3">
<Form
form={form}
handleSubmit={(values) => {
addAction(
values.action,
values.sendTo,
values.numberRequired,
values.senderId,
values.senderName
);
form.unregister("sendTo");
form.unregister("action");
form.unregister("numberRequired");
setIsOpenDialog(false);
setIsPhoneNumberNeeded(false);
setIsEmailAddressNeeded(false);
setIsSenderIdNeeded(false);
}}>
<div className="space-y-1">
<Label htmlFor="label">{t("action")}:</Label>
<Controller
name="action"
control={form.control}
render={() => {
return (
<Select
isSearchable={false}
className="text-sm"
defaultValue={actionOptions[0]}
onChange={handleSelectAction}
options={actionOptions}
isOptionDisabled={(option: {
label: string;
value: WorkflowActions;
needsUpgrade: boolean;
}) => option.needsUpgrade}
/>
);
}}
/>
{form.formState.errors.action && (
<p className="mt-1 text-sm text-red-500">{form.formState.errors.action.message}</p>
)}
</div>
{isPhoneNumberNeeded && (
<div className="mt-5 space-y-1">
<Label htmlFor="label">{t("action")}:</Label>
<Controller
name="action"
control={form.control}
render={() => {
return (
<Select
isSearchable={false}
className="text-sm"
defaultValue={actionOptions[0]}
onChange={handleSelectAction}
options={actionOptions}
isOptionDisabled={(option: {
label: string;
value: WorkflowActions;
needsUpgrade: boolean;
}) => option.needsUpgrade}
/>
);
}}
/>
{form.formState.errors.action && (
<p className="mt-1 text-sm text-red-500">{form.formState.errors.action.message}</p>
)}
</div>
{isPhoneNumberNeeded && (
<div className="mt-5 space-y-1">
<Label htmlFor="sendTo">{t("phone_number")}</Label>
<div className="mb-5 mt-1">
<Controller
control={form.control}
name="sendTo"
render={({ field: { value, onChange } }) => (
<PhoneInput
className="rounded-md"
placeholder={t("enter_phone_number")}
id="sendTo"
required
value={value}
onChange={onChange}
/>
)}
/>
{form.formState.errors.sendTo && (
<p className="mt-1 text-sm text-red-500">{form.formState.errors.sendTo.message}</p>
)}
</div>
</div>
)}
{isEmailAddressNeeded && (
<div className="mt-5">
<EmailField required label={t("email_address")} {...form.register("sendTo")} />
</div>
)}
{isSenderIdNeeded ? (
<>
<div className="mt-5">
<div className="flex">
<Label>{t("sender_id")}</Label>
<Tooltip content={t("sender_id_info")}>
<Info className="ml-2 mr-1 mt-0.5 h-4 w-4 text-gray-500" />
</Tooltip>
</div>
<Input
type="text"
placeholder={SENDER_ID}
maxLength={11}
{...form.register(`senderId`)}
/>
</div>
{form.formState.errors && form.formState?.errors?.senderId && (
<p className="mt-1 text-xs text-red-500">{t("sender_id_error_message")}</p>
)}
</>
) : (
<div className="mt-5">
<Label>{t("sender_name")}</Label>
<Input type="text" placeholder={SENDER_NAME} {...form.register(`senderName`)} />
</div>
)}
{form.getValues("action") === WorkflowActions.SMS_ATTENDEE && (
<div className="mt-5">
<Label htmlFor="sendTo">{t("phone_number")}</Label>
<div className="mb-5 mt-1">
<Controller
name="numberRequired"
control={form.control}
render={() => (
<Checkbox
defaultChecked={form.getValues("numberRequired") || false}
description={t("make_phone_number_required")}
onChange={(e) => form.setValue("numberRequired", e.target.checked)}
name="sendTo"
render={({ field: { value, onChange } }) => (
<PhoneInput
className="rounded-md"
placeholder={t("enter_phone_number")}
id="sendTo"
required
value={value}
onChange={onChange}
/>
)}
/>
{form.formState.errors.sendTo && (
<p className="mt-1 text-sm text-red-500">{form.formState.errors.sendTo.message}</p>
)}
</div>
)}
<DialogFooter>
<DialogClose
onClick={() => {
setIsOpenDialog(false);
form.unregister("sendTo");
form.unregister("action");
form.unregister("numberRequired");
setIsPhoneNumberNeeded(false);
setIsEmailAddressNeeded(false);
setIsSenderIdNeeded(false);
}}
</div>
)}
{isEmailAddressNeeded && (
<div className="mt-5">
<EmailField required label={t("email_address")} {...form.register("sendTo")} />
</div>
)}
{isSenderIdNeeded ? (
<>
<div className="mt-5">
<div className="flex">
<Label>{t("sender_id")}</Label>
<Tooltip content={t("sender_id_info")}>
<Info className="ml-2 mr-1 mt-0.5 h-4 w-4 text-gray-500" />
</Tooltip>
</div>
<Input type="text" placeholder={SENDER_ID} maxLength={11} {...form.register(`senderId`)} />
</div>
{form.formState.errors && form.formState?.errors?.senderId && (
<p className="mt-1 text-xs text-red-500">{t("sender_id_error_message")}</p>
)}
</>
) : (
<div className="mt-5">
<Label>{t("sender_name")}</Label>
<Input type="text" placeholder={SENDER_NAME} {...form.register(`senderName`)} />
</div>
)}
{form.getValues("action") === WorkflowActions.SMS_ATTENDEE && (
<div className="mt-5">
<Controller
name="numberRequired"
control={form.control}
render={() => (
<Checkbox
defaultChecked={form.getValues("numberRequired") || false}
description={t("make_phone_number_required")}
onChange={(e) => form.setValue("numberRequired", e.target.checked)}
/>
)}
/>
<Button type="submit">{t("add")}</Button>
</DialogFooter>
</Form>
</div>
</div>
)}
<DialogFooter showDivider className="mt-12">
<DialogClose
onClick={() => {
setIsOpenDialog(false);
form.unregister("sendTo");
form.unregister("action");
form.unregister("numberRequired");
setIsPhoneNumberNeeded(false);
setIsEmailAddressNeeded(false);
setIsSenderIdNeeded(false);
}}
/>
<Button type="submit">{t("add")}</Button>
</DialogFooter>
</Form>
</div>
</DialogContent>
</Dialog>
@@ -20,6 +20,7 @@ import {
Dialog,
DialogClose,
DialogContent,
DialogFooter,
Dropdown,
DropdownMenuContent,
DropdownMenuItem,
@@ -880,17 +881,17 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
</ConfirmationDialogContent>
</Dialog> */}
<Dialog open={isAdditionalInputsDialogOpen} onOpenChange={setIsAdditionalInputsDialogOpen}>
<DialogContent type="creation" className="sm:max-w-[610px] md:h-[570px]">
<DialogContent type="creation" className="sm:max-w-[610px]">
<div className="-m-3 h-[430px] overflow-x-hidden overflow-y-scroll sm:m-0">
<h1 className="w-full text-xl font-semibold ">{t("how_booking_questions_as_variables")}</h1>
<div className="bg-muted-3 mb-7 mt-7 rounded-md sm:p-4">
<div className="bg-muted-3 mb-6 rounded-md sm:p-4">
<p className="test-sm font-medium">{t("format")}</p>
<ul className="text-emphasis ml-5 mt-2 list-disc">
<li>{t("uppercase_for_letters")}</li>
<li>{t("replace_whitespaces_underscores")}</li>
<li>{t("ignore_special_characters_booking_questions")}</li>
</ul>
<div className="mt-6">
<div className="mt-4">
<p className="test-sm w-full font-medium">{t("example_1")}</p>
<div className="mt-2 grid grid-cols-12">
<div className="test-sm text-default col-span-5 ltr:mr-2 rtl:ml-2">
@@ -909,7 +910,7 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
</div>
</div>
</div>
<div className="mt-6">
<div className="mt-4">
<p className="test-sm w-full font-medium">{t("example_2")}</p>
<div className="mt-2 grid grid-cols-12">
<div className="test-sm text-default col-span-5 ltr:mr-2 rtl:ml-2">
@@ -929,9 +930,9 @@ export default function WorkflowStepContainer(props: WorkflowStepProps) {
</div>
</div>
</div>
<div className="flex flex-row-reverse">
<DialogFooter showDivider className="flex flex-row-reverse">
<DialogClose color="primary" />
</div>
</DialogFooter>
</DialogContent>
</Dialog>
</>
@@ -46,7 +46,7 @@ export function BulkEditDefaultConferencingModal(props: { open: boolean; setOpen
}}>
<div className="flex flex-col space-y-2">
{data.eventTypes.length > 0 && (
<div className="flex items-center space-x-2 rounded-md px-3 py-2.5">
<div className="flex items-center space-x-2 rounded-md px-3 pb-2.5 pt-1">
<Checkbox
description={t("select_all")}
descriptionAsLabel
@@ -75,7 +75,7 @@ export function BulkEditDefaultConferencingModal(props: { open: boolean; setOpen
</div>
))}
</div>
<DialogFooter>
<DialogFooter showDivider className="mt-10">
<DialogClose
onClick={() => {
utils.viewer.getUsersDefaultConferencingApp.invalidate();
@@ -166,7 +166,7 @@ export default function CreateEventTypeDialog({
handleSubmit={(values) => {
createMutation.mutate(values);
}}>
<div className="mt-3 space-y-6 pb-10">
<div className="mt-3 space-y-6 pb-11">
{teamId && (
<TextField
type="hidden"
@@ -10,7 +10,17 @@ import { md } from "@calcom/lib/markdownIt";
import slugify from "@calcom/lib/slugify";
import turndown from "@calcom/lib/turndownService";
import { trpc } from "@calcom/trpc/react";
import { Button, Dialog, DialogClose, DialogContent, Form, showToast, TextField, Editor } from "@calcom/ui";
import {
Button,
Dialog,
DialogClose,
DialogContent,
DialogFooter,
Form,
showToast,
TextField,
Editor,
} from "@calcom/ui";
const querySchema = z.object({
title: z.string(),
@@ -81,7 +91,7 @@ const DuplicateDialog = () => {
handleSubmit={(values) => {
duplicateMutation.mutate(values);
}}>
<div className="mt-3 space-y-6">
<div className="-mt-2 space-y-5">
<TextField
label={t("title")}
placeholder={t("quick_chat")}
@@ -139,12 +149,12 @@ const DuplicateDialog = () => {
/>
</div>
</div>
<div className="mt-8 flex flex-row-reverse gap-x-2">
<DialogFooter showDivider className="mt-10 flex flex-row-reverse gap-x-2">
<DialogClose />
<Button type="submit" loading={duplicateMutation.isLoading}>
{t("continue")}
</Button>
<DialogClose />
</div>
</DialogFooter>
</Form>
</DialogContent>
</Dialog>
@@ -542,7 +542,7 @@ export const FormBuilder = function FormBuilder({
/>
</Form>
</div>
<DialogFooter className="relative rounded px-8 pb-8" showDivider>
<DialogFooter className="relative rounded px-8 pb-8 mt-5" showDivider>
<DialogClose color="secondary">{t("cancel")}</DialogClose>
<Button data-testid="field-add-save" type="submit" form="form-builder">
{isFieldEditMode ? t("save") : t("add")}
@@ -70,7 +70,8 @@ export default function TimezoneChangeDialog() {
{/* todo: save this in db and auto-update when timezone changes (be able to disable??? if yes, /settings)
<Checkbox description="Always update timezone" />
*/}
<DialogFooter>
<div className="mb-8" />
<DialogFooter showDivider>
<DialogClose onClick={() => onCancel(THREE_MONTHS, true)} color="secondary">
{t("dont_update")}
</DialogClose>
+9 -2
View File
@@ -134,10 +134,17 @@ export function DialogHeader(props: DialogHeaderProps) {
);
}
export function DialogFooter(props: { children: ReactNode; className?: string; showDivider?: boolean }) {
export function DialogFooter(props: {
children: ReactNode;
className?: string;
showDivider?: boolean;
customDividerClassNames?: string;
}) {
return (
<div className={classNames("bg-default", props.className)}>
{props.showDivider && <hr className="border-subtle absolute right-0 w-full" />}
{props.showDivider && (
<hr className={classNames("border-subtle absolute right-0 w-full", props.customDividerClassNames)} />
)}
<div
className={classNames(
"flex justify-end space-x-2 pt-4 rtl:space-x-reverse",