diff --git a/apps/web/playwright/availability.e2e.ts b/apps/web/playwright/availability.e2e.ts index 45cacf85ef..d065e3dbb5 100644 --- a/apps/web/playwright/availability.e2e.ts +++ b/apps/web/playwright/availability.e2e.ts @@ -28,6 +28,7 @@ test.describe("Availablity tests", () => { await page.locator('[data-testid="day"][data-disabled="false"]').nth(0).click(); await page.locator('[data-testid="date-override-mark-unavailable"]').click(); await page.locator('[data-testid="add-override-submit-btn"]').click(); + await page.locator('[data-testid="dialog-rejection"]').click(); await expect(page.locator('[data-testid="date-overrides-list"] > li')).toHaveCount(1); await page.locator('[form="availability-form"][type="submit"]').click(); }); diff --git a/packages/features/schedules/components/DateOverrideInputDialog.tsx b/packages/features/schedules/components/DateOverrideInputDialog.tsx index e5b396f4f7..487c9d1fd3 100644 --- a/packages/features/schedules/components/DateOverrideInputDialog.tsx +++ b/packages/features/schedules/components/DateOverrideInputDialog.tsx @@ -3,7 +3,6 @@ import { useForm } from "react-hook-form"; import type { Dayjs } from "@calcom/dayjs"; import dayjs from "@calcom/dayjs"; -import { classNames } from "@calcom/lib"; import { yyyymmdd } from "@calcom/lib/date-fns"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import useMediaQuery from "@calcom/lib/hooks/useMediaQuery"; @@ -23,15 +22,11 @@ import DatePicker from "../../calendars/DatePicker"; import type { TimeRange } from "./Schedule"; import { DayRanges } from "./Schedule"; -// eslint-disable-next-line @typescript-eslint/no-empty-function -const noop = () => {}; - const DateOverrideForm = ({ value, workingHours, excludedDates, onChange, - onClose = noop, }: { workingHours?: WorkingHours[]; onChange: (newValue: TimeRange[]) => void; @@ -137,14 +132,10 @@ const DateOverrideForm = ({ }) : datesInRanges ); - onClose(); + setSelectedDates([]); }} className="p-6 sm:flex sm:p-0 md:flex-col lg:flex-col xl:flex-row"> -
+
- {selectedDates[0] && ( -
-
-

{t("date_overrides_dialog_which_hours")}

-
- {datesUnavailable ? ( -

- {t("date_overrides_unavailable")} -

- ) : ( - - )} +
+ {selectedDates[0] ? ( + <> +
+

{t("date_overrides_dialog_which_hours")}

+
+ {datesUnavailable ? ( +

+ {t("date_overrides_unavailable")} +

+ ) : ( + + )} +
+
- +
+ + +
+ + ) : ( +
+
-
- - -
-
- )} + )} +
); }; @@ -220,7 +217,7 @@ const DateOverrideInputDialog = ({ {Trigger} - + {/* This will require the i18n string passed in */} -