fix: Provide event rescheduling option before the event end time (#15150)
* feat: Provide event rescheduling option * update * update * add checker function * refactor and update * update * fix type error * Update bookings-single-view.tsx --------- Co-authored-by: Somay Chauhan <[email protected]>
This commit is contained in:
1 parent
ececef96e5
commit
3807e339ce
3 files changed
+43
-14
No files matched your search
@@ -296,7 +296,7 @@ export default function Success(props: PageProps) {
|
||||
function getTitle(): string {
|
||||
const titleSuffix = props.recurringBookings ? "_recurring" : "";
|
||||
const titlePrefix = isRoundRobin ? "round_robin_" : "";
|
||||
if (isCancelled) {
|
||||
if (isCancelled || isBookingInPast) {
|
||||
return "";
|
||||
}
|
||||
if (needsConfirmation) {
|
||||
@@ -340,6 +340,8 @@ export default function Success(props: PageProps) {
|
||||
|
||||
const providerName = guessEventLocationType(location)?.label;
|
||||
const rescheduleProviderName = guessEventLocationType(rescheduleLocation)?.label;
|
||||
const isBookingInPast = new Date(bookingInfo.endTime) < new Date();
|
||||
const isReschedulable = !isCancelled && !isBookingInPast;
|
||||
|
||||
const bookingCancelledEventProps = {
|
||||
booking: bookingInfo,
|
||||
@@ -412,7 +414,7 @@ export default function Success(props: PageProps) {
|
||||
imageSrc={`${bookingInfo.user.avatarUrl}`}
|
||||
/>
|
||||
)}
|
||||
{giphyImage && !needsConfirmation && !isCancelled && (
|
||||
{giphyImage && !needsConfirmation && isReschedulable && (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img src={giphyImage} className="w-full rounded-lg" alt="Gif from Giphy" />
|
||||
)}
|
||||
@@ -421,17 +423,19 @@ export default function Success(props: PageProps) {
|
||||
"mx-auto flex h-12 w-12 items-center justify-center rounded-full",
|
||||
isRoundRobin &&
|
||||
"border-cal-bg dark:border-cal-bg-muted absolute bottom-0 right-0 z-10 h-12 w-12 border-8",
|
||||
!giphyImage && !isCancelled && !needsConfirmation ? "bg-success" : "",
|
||||
!giphyImage && !isCancelled && needsConfirmation ? "bg-subtle" : "",
|
||||
isCancelled ? "bg-error" : ""
|
||||
!giphyImage && isReschedulable && !needsConfirmation ? "bg-success" : "",
|
||||
!giphyImage && isReschedulable && needsConfirmation ? "bg-subtle" : "",
|
||||
isCancelled || isBookingInPast ? "bg-error" : ""
|
||||
)}>
|
||||
{!giphyImage && !needsConfirmation && !isCancelled && (
|
||||
{!giphyImage && !needsConfirmation && isReschedulable && (
|
||||
<Icon name="check" className="h-5 w-5 text-green-600 dark:text-green-400" />
|
||||
)}
|
||||
{needsConfirmation && !isCancelled && (
|
||||
{needsConfirmation && isReschedulable && (
|
||||
<Icon name="calendar" className="text-emphasis h-5 w-5" />
|
||||
)}
|
||||
{isCancelled && <Icon name="x" className="h-5 w-5 text-red-600 dark:text-red-200" />}
|
||||
{(isCancelled || isBookingInPast) && (
|
||||
<Icon name="x" className="h-5 w-5 text-red-600 dark:text-red-200" />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="mb-8 mt-6 text-center last:mb-0">
|
||||
@@ -439,7 +443,7 @@ export default function Success(props: PageProps) {
|
||||
className="text-emphasis text-2xl font-semibold leading-6"
|
||||
data-testid={isCancelled ? "cancelled-headline" : ""}
|
||||
id="modal-headline">
|
||||
{needsConfirmation && !isCancelled
|
||||
{needsConfirmation && isReschedulable
|
||||
? props.recurringBookings
|
||||
? t("booking_submitted_recurring")
|
||||
: t("booking_submitted")
|
||||
@@ -447,6 +451,8 @@ export default function Success(props: PageProps) {
|
||||
? seatReferenceUid
|
||||
? t("no_longer_attending")
|
||||
: t("event_cancelled")
|
||||
: isBookingInPast
|
||||
? t("event_expired")
|
||||
: props.recurringBookings
|
||||
? t("meeting_is_scheduled_recurring")
|
||||
: t("meeting_is_scheduled")}
|
||||
@@ -650,7 +656,7 @@ export default function Success(props: PageProps) {
|
||||
)}
|
||||
{!requiresLoginToUpdate &&
|
||||
(!needsConfirmation || !userIsOwner) &&
|
||||
!isCancelled &&
|
||||
isReschedulable &&
|
||||
(!isCancellationMode ? (
|
||||
<>
|
||||
<hr className="border-subtle mb-8" />
|
||||
@@ -708,7 +714,7 @@ export default function Success(props: PageProps) {
|
||||
{userIsOwner &&
|
||||
!needsConfirmation &&
|
||||
!isCancellationMode &&
|
||||
!isCancelled &&
|
||||
isReschedulable &&
|
||||
!!calculatedDuration && (
|
||||
<>
|
||||
<hr className="border-subtle mt-8" />
|
||||
|
||||
@@ -2484,5 +2484,7 @@
|
||||
"USER_PENDING_MEMBER_OF_THE_ORG": "User is a pending member of the organization",
|
||||
"USER_ALREADY_INVITED_OR_MEMBER": "User is already invited or a member",
|
||||
"USER_MEMBER_OF_OTHER_ORGANIZATION": "User is member of an organization that this team is not a part of.",
|
||||
"rescheduling_not_possible": "Rescheduling is not possible as the event has expired",
|
||||
"event_expired": "This event is expired",
|
||||
"ADD_NEW_STRINGS_ABOVE_THIS_LINE_TO_PREVENT_MERGE_CONFLICTS": "↑↑↑↑↑↑↑↑↑↑↑↑↑ Add your new strings above here ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑"
|
||||
}
|
||||
Reference in new issue
Block a user