feat: Rerouting a booking with corrected responses (#17074)

* POC working with no TS error

* cleanup

* Fix query booking

* Simplify things

* Support rerouting to different event

* self-review fixes

* Some improvements

* add more tests

* Remove members relation query

* Udits feedback

* Dont show CTAs when non-eventTypeRedirectUrl action route is chosen

---------

Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
Hariom BalharaandUdit Takkar authored and GitHub committed 2024-10-18 17:11:50 -04:00
1 parent 4f14775a4d
commit b8d4fccbab
33 files changed
+1990 -98

No files matched your search

@@ -78,7 +78,6 @@ export default function Bookings() {
const { t } = useLocale();
const user = useMeQuery().data;
const [isFiltersVisible, setIsFiltersVisible] = useState<boolean>(false);
const query = trpc.viewer.bookings.get.useInfiniteQuery(
{
limit: 10,
@@ -88,7 +87,6 @@ export default function Bookings() {
},
},
{
// first render has status `undefined`
enabled: true,
getNextPageParam: (lastPage) => lastPage.nextCursor,
}
@@ -365,12 +365,16 @@ export default function Success(props: PageProps) {
const isNotAttendingSeatedEvent = isCancelled && seatReferenceUid;
const isEventCancelled = isCancelled && !seatReferenceUid;
const isPastBooking = isBookingInPast;
const isRerouting = searchParams?.get("cal.rerouting") === "true";
const successPageHeadline = (() => {
if (needsConfirmationAndReschedulable) {
return isRecurringBooking ? t("booking_submitted_recurring") : t("booking_submitted");
}
if (isRerouting) {
return t("This meeting has been rerouted");
}
if (isNotAttendingSeatedEvent) {
return t("no_longer_attending");
}
@@ -476,6 +480,7 @@ export default function Success(props: PageProps) {
id="modal-headline">
{successPageHeadline}
</h3>
<div className="mt-3">
<p className="text-default">{getTitle()}</p>
</div>
@@ -691,6 +696,7 @@ export default function Success(props: PageProps) {
{!requiresLoginToUpdate &&
(!needsConfirmation || !userIsOwner) &&
isReschedulable &&
!isRerouting &&
(!isCancellationMode ? (
<>
<hr className="border-subtle mb-8" />
@@ -750,6 +756,18 @@ export default function Success(props: PageProps) {
/>
</>
))}
{isRerouting && typeof window !== "undefined" && window.opener && (
<div className="flex justify-center">
<Button
type="button"
onClick={() => {
window.opener.focus();
window.close();
}}>
Go Back
</Button>
</div>
)}
{userIsOwner &&
!needsConfirmation &&
!isCancellationMode &&