Skip to content

Commit 1fd64c5

Browse files
authored
chore: improve text for booker active booking limit (calcom#24526)
* chore: improve text for booker active booking limit * update keys to new one for lingo .dev future recognition
1 parent f8614f1 commit 1fd64c5

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

apps/web/public/static/locales/en/common.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,7 +1893,7 @@
18931893
"only_show_first_available_slot_description": "This will limit your availability for this event type to one slot per day, scheduled at the earliest available time.",
18941894
"limit_total_booking_duration": "Limit total booking duration",
18951895
"limit_total_booking_duration_description": "Limit total amount of time that this event can be booked",
1896-
"booker_booking_limit": "Booker active booking limit",
1896+
"booker_upcoming_limit": "Limit number of upcoming bookings per booker",
18971897
"booker_booking_limit_description": "Limit the number of active bookings a booker can make for this event type",
18981898
"recurring_event_doesnt_support_booker_booking_limit": "Recurring events don't support booker booking limit",
18991899
"add_limit": "Add Limit",
@@ -3636,8 +3636,8 @@
36363636
"error_downloading_expense_log": "Error downloading expense log",
36373637
"require_booker_email_verification": "Prevent Impersonation on Bookings",
36383638
"require_booker_email_verification_description": "When enabled, anyone trying to book events using your email address must verify they own it via a one time code or be logged in to prevent impersonation",
3639-
"offer_to_reschedule_last_booking": "Offer to reschedule last active booking to chosen time slot",
3640-
"booker_limit_exceeded_error": "Booker maximum active booking limit exceeded",
3639+
"reschedule_last_booking_offer": "Offer to reschedule the last booking to the new time slot",
3640+
"booker_upcoming_limit_reached": "You've reached the limit of {{count}} upcoming bookings for this event type",
36413641
"booker_limit_exceeded_error_reschedule": "You already have a booking for this event on {{date}}. Would you like to reschedule to the new selected time?",
36423642
"duration_min_error": "Duration must be at least {{min}} minute(s)",
36433643
"duration_max_error": "Duration cannot exceed {{max}} minutes (24 hours)",

packages/features/bookings/Booker/components/BookEventForm/BookEventForm.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ const getError = ({
301301
const error = dataError;
302302

303303
let date = "";
304+
let count = 0;
304305

305306
if (error.message === ErrorCode.BookerLimitExceededReschedule) {
306307
const formattedDate = formatEventFromTime({
@@ -312,9 +313,16 @@ const getError = ({
312313
date = `${formattedDate.date} ${formattedDate.time}`;
313314
}
314315

316+
if (error.message === ErrorCode.BookerLimitExceeded && error.data?.count) {
317+
count = error.data.count;
318+
}
319+
320+
const messageKey =
321+
error.message === ErrorCode.BookerLimitExceeded ? "booker_upcoming_limit_reached" : error.message;
322+
315323
return error?.message ? (
316324
<>
317-
{responseVercelIdHeader ?? ""} {t(error.message, { date })}
325+
{responseVercelIdHeader ?? ""} {t(messageKey, { date, count })}
318326
</>
319327
) : (
320328
<>{t("can_you_try_again")}</>

packages/features/bookings/lib/handleNewBooking/checkActiveBookingsLimitForBooker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ const checkActiveBookingsLimit = async ({
6161

6262
if (bookingsCount >= maxActiveBookingsPerBooker) {
6363
log.warn(`Maximum booking limit reached for ${bookerEmail} for event type ${eventTypeId}`);
64-
throw new ErrorWithCode(ErrorCode.BookerLimitExceeded, ErrorCode.BookerLimitExceeded);
64+
throw new ErrorWithCode(ErrorCode.BookerLimitExceeded, ErrorCode.BookerLimitExceeded, {
65+
count: maxActiveBookingsPerBooker,
66+
});
6567
}
6668
};
6769

packages/features/eventtypes/components/tabs/limits/MaxActiveBookingsPerBookerController.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default function MaxActiveBookingsPerBookerController({
4747
isChecked && "rounded-b-none"
4848
)}
4949
childrenClassName={classNames("lg:ml-0")}
50-
title={t("booker_booking_limit")}
50+
title={t("booker_upcoming_limit")}
5151
description={t("booker_booking_limit_description")}
5252
checked={isChecked}
5353
onCheckedChange={(active) => {
@@ -76,7 +76,7 @@ export default function MaxActiveBookingsPerBookerController({
7676
<CheckboxField
7777
checked={!!maxActiveBookingPerBookerOfferReschedule}
7878
descriptionAsLabel
79-
description={t("offer_to_reschedule_last_booking")}
79+
description={t("reschedule_last_booking_offer")}
8080
disabled={maxActiveBookingsPerBookerLocked.disabled}
8181
onChange={(e) => {
8282
formMethods.setValue("maxActiveBookingPerBookerOfferReschedule", e.target.checked, {

0 commit comments

Comments
 (0)