feat: added rescheduled UI to Booking page and Booking Listing page (#20401)

* feat: add rescheduling to UI

- Introduced displaying the original booking information.
- Updated UI components to show rescheduling status and details.

* fix: update link styling in booking single view

- Changed link text size to small for better UI consistency in the booking details section.

* refactor, type fixes

* added missing margin

* added rescheduled under other badges

* optimised getting booking

* updated namings and perf

---------

Co-authored-by: amrit <[email protected]>
This commit is contained in:
Gaurav Vermaandamrit authored and GitHub committed 2025-04-09 15:21:26 -04:00
1 parent 5ae50f8670
commit d3d4a90776
7 files changed
+69 -1

No files matched your search

@@ -82,6 +82,17 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
rescheduledToUid = rescheduledTo?.uid ?? null;
}
let previousBooking: {
rescheduledBy: string | null;
uid: string;
} | null = null;
if (bookingInfo.fromReschedule) {
previousBooking = await BookingRepository.findReschedulerByUid({
uid: bookingInfo.fromReschedule,
});
}
const eventTypeRaw = !bookingInfoRaw.eventTypeId
? getDefaultEvent(eventTypeSlug || "")
: await getEventTypesFromDB(bookingInfoRaw.eventTypeId);
@@ -220,6 +231,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
recurringBookings: await getRecurringBookings(bookingInfo.recurringEventId),
dynamicEventName: bookingInfo?.eventType?.eventName || "",
bookingInfo,
previousBooking,
paymentStatus: payment,
...(tz && { tz }),
userTimeFormat,
@@ -104,7 +104,9 @@ export default function Success(props: PageProps) {
const routerQuery = useRouterQuery();
const pathname = usePathname();
const searchParams = useCompatSearchParams();
const { eventType, bookingInfo, requiresLoginToUpdate, rescheduledToUid } = props;
const { eventType, bookingInfo, previousBooking, requiresLoginToUpdate, rescheduledToUid } = props;
const {
allRemainingBookings,
isSuccessBookingPage,
@@ -519,6 +521,17 @@ export default function Success(props: PageProps) {
<div className="col-span-2 mb-6 last:mb-0">{cancellationReason}</div>
</>
)}
{previousBooking && (
<>
<div className="font-medium">{t("rescheduled_by")}</div>
<div className="col-span-2 mb-6 last:mb-0">
<p className="break-words">{previousBooking?.rescheduledBy}</p>
<Link className="text-sm underline" href={`/booking/${previousBooking?.uid}`}>
{t("original_booking")}
</Link>
</div>
</>
)}
<div className="font-medium">{t("what")}</div>
<div className="col-span-2 mb-6 last:mb-0" data-testid="booking-title">
{isRoundRobin ? bookingInfo.title : eventName}