Files
cal.diy/packages/features/bookings/Booker/components/DryRunMessage.tsx
T
Hariom BalharaandUdit Takkar bac2d1f6f0 feat: Add dry run mode functionality and message display in booking process (#18429)
- Introduced a new `DryRunMessage` component to inform users when in dry run mode.
- Implemented utility function `isBookingDryRun` to check for dry run status based on URL search parameters.
- Updated the `Booker` component to conditionally render the dry run message.
- Adjusted booking mutation input mapping to reuse the utility

Co-authored-by: Udit Takkar <[email protected]>
2025-01-01 11:40:53 +00:00

27 lines
871 B
TypeScript

import { useState } from "react";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Icon } from "@calcom/ui";
export const DryRunMessage = ({ isEmbed }: { isEmbed?: boolean }) => {
const { t } = useLocale();
const [isVisible, setIsVisible] = useState(true);
if (!isVisible) return null;
return (
<div
onClick={() => setIsVisible(false)}
className={`bg-default border-subtle fixed left-1/2 ${
!isEmbed ? "top-4" : "top-0"
} z-50 -translate-x-1/2 transform cursor-pointer items-center gap-3 rounded-xl border p-3 text-sm shadow-md`}>
<div className="flex items-center gap-3">
<div className="relative">
<Icon name="info" className="h-5 w-5 text-orange-500" />
</div>
<div className="text-emphasis font-medium">{t("dry_run_mode_active")}</div>
</div>
</div>
);
};