@@ -24,6 +24,7 @@ import {
2424import { Price } from "@calcom/features/bookings/components/event-meta/Price" ;
2525import { getCalendarLinks , CalendarLinkType } from "@calcom/features/bookings/lib/getCalendarLinks" ;
2626import { RATING_OPTIONS , validateRating } from "@calcom/features/bookings/lib/rating" ;
27+ import { isWithinMinimumRescheduleNotice as isWithinMinimumRescheduleNoticeUtil } from "@calcom/features/bookings/lib/reschedule/isWithinMinimumRescheduleNotice" ;
2728import type { nameObjectSchema } from "@calcom/features/eventtypes/lib/eventNaming" ;
2829import { getEventName } from "@calcom/features/eventtypes/lib/eventNaming" ;
2930import { shouldShowFieldInCustomResponses } from "@calcom/lib/bookings/SystemField" ;
@@ -52,6 +53,7 @@ import { EmptyScreen } from "@calcom/ui/components/empty-screen";
5253import { EmailInput , TextArea } from "@calcom/ui/components/form" ;
5354import { Icon } from "@calcom/ui/components/icon" ;
5455import { showToast } from "@calcom/ui/components/toast" ;
56+ import { Tooltip } from "@calcom/ui/components/tooltip" ;
5557import { useCalcomTheme } from "@calcom/ui/styles" ;
5658import CancelBooking from "@calcom/web/components/booking/CancelBooking" ;
5759import EventReservationSchema from "@calcom/web/components/schemas/EventReservationSchema" ;
@@ -385,6 +387,15 @@ export default function Success(props: PageProps) {
385387 const canCancel = ! eventType ?. disableCancelling ;
386388 const canReschedule = ! eventType ?. disableRescheduling ;
387389
390+ // Check if reschedule should be disabled due to minimum reschedule notice
391+ // Use server-side computed isHost prop instead of client-side computation
392+ const isWithinMinimumRescheduleNotice = isHost
393+ ? false // Organizers can always reschedule
394+ : isWithinMinimumRescheduleNoticeUtil (
395+ bookingInfo ?. startTime ?? null ,
396+ eventType ?. minimumRescheduleNotice ?? null
397+ ) ;
398+ const isRescheduleDisabled = ! canReschedule || isWithinMinimumRescheduleNotice ;
388399 const paymentStatusMessage = usePaymentStatus ( {
389400 bookingStatus : bookingInfo . status ,
390401 startTime : bookingInfo . startTime ,
@@ -489,7 +500,7 @@ export default function Success(props: PageProps) {
489500 { ! isFeedbackMode && (
490501 < >
491502 < div
492- className = { classNames ( isRoundRobin && "min-w-32 min-h-24 relative mx-auto h-24 w-32" ) } >
503+ className = { classNames ( isRoundRobin && "relative mx-auto h-24 min-h-24 w-32 min- w-32" ) } >
493504 { isRoundRobin && bookingInfo . user && (
494505 < Avatar
495506 className = "mx-auto flex items-center justify-center"
@@ -539,7 +550,7 @@ export default function Success(props: PageProps) {
539550 ( bookingInfo . status === BookingStatus . CANCELLED ||
540551 bookingInfo . status === BookingStatus . REJECTED ) && < h4 > { paymentStatusMessage } </ h4 > }
541552
542- < div className = "border-subtle text-default mt-8 grid grid-cols-3 gap-x-4 border-t pt-8 text-left rtl:text-right sm:gap-x-0" >
553+ < div className = "border-subtle text-default mt-8 grid grid-cols-3 gap-x-4 border-t pt-8 text-left sm:gap-x-0 rtl:text-right " >
543554 { ( isCancelled || reschedule ) && cancellationReason && (
544555 < >
545556 < div className = "font-medium" >
@@ -810,47 +821,56 @@ export default function Success(props: PageProps) {
810821 canCancelOrReschedule &&
811822 ( ! isCancellationMode ? (
812823 < >
813- < hr className = "border-subtle mb-8" />
814- < div className = "text-center last:pb-0" >
815- < span className = "text-emphasis ltr:mr-2 rtl:ml-2" >
816- { t ( "need_to_make_a_change" ) }
817- </ span >
818-
824+ { /* Only show section if there's at least one actionable option */ }
825+ { ( ( ! props . recurringBookings &&
826+ ( ! isBookingInPast || eventType . allowReschedulingPastBookings ) &&
827+ canReschedule ) ||
828+ ( ! isBookingInPast && canCancel ) ) && (
819829 < >
820- { ! props . recurringBookings &&
821- ( ! isBookingInPast || eventType . allowReschedulingPastBookings ) &&
822- canReschedule && (
823- < span className = "text-default inline" >
824- < span className = "underline" data-testid = "reschedule-link" >
825- < Link
826- href = { `/reschedule/${ seatReferenceUid || bookingInfo ?. uid } ${
827- currentUserEmail
828- ? `?rescheduledBy=${ encodeURIComponent ( currentUserEmail ) } `
829- : ""
830- } `}
831- legacyBehavior >
832- { t ( "reschedule" ) }
833- </ Link >
834- </ span >
835- { ! isBookingInPast && canCancel && (
836- < span className = "mx-2" > { t ( "or_lowercase" ) } </ span >
830+ < hr className = "border-subtle mb-8" />
831+ < div className = "text-center last:pb-0" >
832+ < span className = "text-emphasis ltr:mr-2 rtl:ml-2" >
833+ { t ( "need_to_make_a_change" ) }
834+ </ span >
835+
836+ < >
837+ { ! props . recurringBookings &&
838+ ( ! isBookingInPast || eventType . allowReschedulingPastBookings ) &&
839+ canReschedule &&
840+ ! isRescheduleDisabled && (
841+ < span className = "text-default inline" >
842+ < span className = "underline" data-testid = "reschedule-link" >
843+ < Link
844+ href = { `/reschedule/${ seatReferenceUid || bookingInfo ?. uid } ${
845+ currentUserEmail
846+ ? `?rescheduledBy=${ encodeURIComponent ( currentUserEmail ) } `
847+ : ""
848+ } `}
849+ legacyBehavior >
850+ { t ( "reschedule" ) }
851+ </ Link >
852+ </ span >
853+ { ! isBookingInPast && canCancel && (
854+ < span className = "mx-2" > { t ( "or_lowercase" ) } </ span >
855+ ) }
856+ </ span >
837857 ) }
838- </ span >
839- ) }
840-
841- { ! isBookingInPast && canCancel && (
842- < button
843- data-testid = "cancel"
844- className = { classNames (
845- "text-default underline" ,
846- props . recurringBookings && "ltr:mr-2 rtl:ml-2"
858+
859+ { ! isBookingInPast && canCancel && (
860+ < button
861+ data-testid = "cancel"
862+ className = { classNames (
863+ "text-default underline" ,
864+ props . recurringBookings && "ltr:mr-2 rtl:ml-2"
865+ ) }
866+ onClick = { ( ) => setIsCancellationMode ( true ) } >
867+ { t ( "cancel" ) }
868+ </ button >
847869 ) }
848- onClick = { ( ) => setIsCancellationMode ( true ) } >
849- { t ( "cancel" ) }
850- </ button >
851- ) }
870+ </ >
871+ </ div >
852872 </ >
853- </ div >
873+ ) }
854874 </ >
855875 ) : (
856876 < >
@@ -1067,7 +1087,7 @@ export default function Success(props: PageProps) {
10671087 </ div >
10681088 { isGmail && ! isFeedbackMode && (
10691089 < Alert
1070- className = "main -mb-20 mt-4 inline-block ltr:text-left rtl:text-right sm:-mt-4 sm:mb-4 sm:w-full sm:max-w-xl sm:align-middle"
1090+ className = "main -mb-20 mt-4 inline-block sm:-mt-4 sm:mb-4 sm:w-full sm:max-w-xl sm:align-middle ltr:text-left rtl:text-right "
10711091 severity = "warning"
10721092 message = {
10731093 < div >
0 commit comments