-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add dry run mode functionality and message display in booking p…
…rocess - 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
- Loading branch information
1 parent
557bd8b
commit fbab72c
Showing
6 changed files
with
54 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
packages/features/bookings/Booker/components/DryRunMessage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const isBookingDryRun = (searchParams: URLSearchParams) => { | ||
return searchParams.get("cal.isBookingDryRun") === "true"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters