fix: add recurringEventCount to URL params (#24986)
* fix: validate occurrence count from URL params and refactor validation logic - Initialize occurrence count from URL query parameter on page load * fix: change query parameter name from occurenceCount to recurringEventCount * refactor: simplify occurrence count validation logic * fix: prevent NaN from being set in recurring event count query parameter * fix: prevent overlay calendar toggle from overwriting query params * fix: sync occurrence count state with max occurrences limit * refactor: rename occurenceCount to recurringEventCountQueryParam * fix: prevent invalid recurring event count from updating state - Added validation guard to only update state when recurringEventCountQueryParam is valid (not null or NaN) - Simplified URL update logic by removing unnecessary empty string fallback * feat: add recurring event count badge for mobile (#24991) * feat: display recurring event count badge in mobile * feat: update recurring event translation key for clarity
This commit is contained in:
1 parent
421d03eb1a
commit
6af7f8b0db
7 files changed
+75
-46
No files matched your search
@@ -185,20 +185,17 @@ const BookerPlatformWrapperComponent = (props: BookerWebWrapperAtomProps) => {
|
||||
// Toggle query param for overlay calendar
|
||||
const onOverlaySwitchStateChange = useCallback(
|
||||
(state: boolean) => {
|
||||
const current = new URLSearchParams(Array.from(searchParams?.entries() ?? []));
|
||||
const url = new URL(window.location.href);
|
||||
if (state) {
|
||||
current.set("overlayCalendar", "true");
|
||||
url.searchParams.set("overlayCalendar", "true");
|
||||
localStorage.setItem("overlayCalendarSwitchDefault", "true");
|
||||
} else {
|
||||
current.delete("overlayCalendar");
|
||||
url.searchParams.delete("overlayCalendar");
|
||||
localStorage.removeItem("overlayCalendarSwitchDefault");
|
||||
}
|
||||
// cast to string
|
||||
const value = current.toString();
|
||||
const query = value ? `?${value}` : "";
|
||||
router.push(`${pathname}${query}`);
|
||||
router.push(`${url.pathname}${url.search}`);
|
||||
},
|
||||
[searchParams, pathname, router]
|
||||
[router]
|
||||
);
|
||||
useBrandColors({
|
||||
brandColor: event.data?.profile.brandColor ?? DEFAULT_LIGHT_BRAND_COLOR,
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
import type React from "react";
|
||||
|
||||
|
||||
|
||||
import type { BookerProps } from "@calcom/features/bookings/Booker";
|
||||
import type { BookerStore } from "@calcom/features/bookings/Booker/store";
|
||||
import type { Timezone, VIEW_TYPE } from "@calcom/features/bookings/Booker/types";
|
||||
import type { BookingCreateBody } from "@calcom/features/bookings/lib/bookingCreateBodySchema";
|
||||
import type { BookingResponse } from "@calcom/platform-libraries";
|
||||
import type {
|
||||
ApiSuccessResponse,
|
||||
ApiErrorResponse,
|
||||
ApiSuccessResponseWithoutData,
|
||||
RoutingFormSearchParams,
|
||||
} from "@calcom/platform-types";
|
||||
import type { ApiSuccessResponse, ApiErrorResponse, ApiSuccessResponseWithoutData, RoutingFormSearchParams } from "@calcom/platform-types";
|
||||
import type { Slot } from "@calcom/trpc/server/routers/viewer/slots/types";
|
||||
|
||||
|
||||
|
||||
import type { UseCreateBookingInput } from "../hooks/bookings/useCreateBooking";
|
||||
|
||||
|
||||
// Type that includes only the data values from BookerStore (excluding functions)
|
||||
export type BookerStoreValues = Omit<
|
||||
BookerStore,
|
||||
@@ -32,7 +32,7 @@ export type BookerStoreValues = Omit<
|
||||
| "setSelectedDuration"
|
||||
| "setBookingData"
|
||||
| "setRecurringEventCount"
|
||||
| "setOccurenceCount"
|
||||
| "setRecurringEventCountQueryParam"
|
||||
| "setTentativeSelectedTimeslots"
|
||||
| "setSelectedTimeslot"
|
||||
| "setFormValues"
|
||||
@@ -101,4 +101,4 @@ export type BookerPlatformWrapperAtomPropsForTeam = BookerPlatformWrapperAtomPro
|
||||
isTeamEvent: true;
|
||||
teamId: number;
|
||||
routingFormSearchParams?: RoutingFormSearchParams;
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user