Files
calendar/packages/ui/components/dialog/ConfirmationDialogContent.tsx
T
Bailey PumfleetGitHubunknown <>Pedro CastroDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
7c66f33de2 chore: UX Fixes (#26643)
* Copy changes

* Move search bar inline with new button

* Get rid of no more results message

* Change hidden badge to (hidden)

* Remove Cal.ai badge from sidebar

* Add dropdown to create button when there is multiple options

* Fix delete dialog

* Saved filters updates

* More string fixes

* Switch members table to use names

* Fix member spacing

* Fix routing form identifier field

* Fix routing forms stuff

* Only show SMS hint on SMS options

* Make workflow delete button minimal

* Fix padding on workflow steps

* Remove min width on workflow title

* Fix delete workflow PR

* Fix org profile buttons

* Fix org profile screen partially scrolled down

* Improve logos & banner uploads

* Personal profile fixes

* Fix settings general view stuff

* Sentence case consistency

* Fix stuff I broke

* Fix fab

* Fix hidden translation string

* Fix text fields

* Make button small for solo users too

* fix: update E2E tests to match sentence case labels in routing forms

* fix: update tests to match sentence case label changes

- insights.e2e.ts: chart titles (14 strings)
- event-types.e2e.ts: Organizer phone number location
- EditLocationDialog.test.tsx: phone number labels

* fix: address Cubic AI review feedback (confidence 9+)

- Replace hardcoded text-gray-500 with text-muted in TextField.tsx hint section
- Replace text locator with data-testid in E2E test for location select

Co-Authored-By: unknown <>

* fix: update E2E tests for sentence case label changes

- Use data-testid selectors for location options (more reliable than text)
- Update field identifiers in routing-forms tests to match new labels
- Fix Long text selector in manage-booking-questions test

* fix: replace text locator with data-testid in manage-booking-questions E2E test

Replace fragile text="Long text" locator with resilient
page.getByTestId("select-option-textarea") selector per E2E best practices.

Addresses Cubic AI review feedback (confidence 9/10).

Co-Authored-By: unknown <>

* fix: use .last() for multiple location select items

---------

Co-authored-by: Pedro Castro <pedro@cal.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-01-13 00:56:08 -05:00

101 lines
3.0 KiB
TypeScript

import * as DialogPrimitive from "@radix-ui/react-dialog";
import type { PropsWithChildren, ReactElement } from "react";
import React from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Icon } from "../icon";
import { DialogClose, DialogContent } from "./Dialog";
type ConfirmBtnType =
| { confirmBtn?: never; confirmBtnText?: string }
| { confirmBtnText?: never; confirmBtn?: ReactElement };
export type ConfirmationDialogContentProps = {
cancelBtnText?: string;
isPending?: boolean;
loadingText?: string;
onConfirm?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
title: string;
variety?: "danger" | "warning" | "success";
} & ConfirmBtnType;
export function ConfirmationDialogContent(
props: PropsWithChildren<ConfirmationDialogContentProps>
) {
return (
<DialogContent type="creation">
<ConfirmationContent {...props} />
</DialogContent>
);
}
export const ConfirmationContent = (
props: PropsWithChildren<ConfirmationDialogContentProps>
) => {
const { t } = useLocale();
const {
title,
variety,
confirmBtn = null,
confirmBtnText = t("confirm"),
cancelBtnText = t("cancel"),
loadingText = t("loading"),
isPending = false,
onConfirm,
children,
} = props;
return (
<>
<div className="flex">
{variety && (
<div className="mt-0.5 ltr:mr-3">
{variety === "danger" && (
<div className="bg-error mx-auto rounded-full p-2 text-center">
<Icon
name="circle-alert"
className="h-5 w-5 text-red-600 dark:text-red-100"
/>
</div>
)}
{variety === "warning" && (
<div className="bg-attention mx-auto rounded-full p-2 text-center">
<Icon name="circle-alert" className="h-5 w-5 text-orange-600" />
</div>
)}
{variety === "success" && (
<div className="bg-cal-success mx-auto rounded-full p-2 text-center">
<Icon name="check" className="h-5 w-5 text-green-600" />
</div>
)}
</div>
)}
<div className="w-full">
<DialogPrimitive.Title className="font-cal text-emphasis mt-1 text-xl">
{title}
</DialogPrimitive.Title>
<DialogPrimitive.Description asChild>
<div className="text-subtle text-sm">{children}</div>
</DialogPrimitive.Description>
</div>
</div>
<div className="my-5 flex flex-row-reverse gap-x-2 sm:my-8">
{confirmBtn ? (
confirmBtn
) : (
<DialogClose
color="primary"
loading={isPending}
onClick={(e) => onConfirm && onConfirm(e)}
data-testid="dialog-confirmation"
>
{isPending ? loadingText : confirmBtnText}
</DialogClose>
)}
<DialogClose disabled={isPending}>{cancelBtnText}</DialogClose>
</div>
</>
);
};