Applying feedback from a merged PR (#4887)

This commit is contained in:
Leo Giovanetti authored and GitHub committed 2022-10-06 17:38:50 -03:00
1 parent 41c1e960f8
commit 0098591a56
2 files changed
+15 -27

No files matched your search

+10 -10
View File
@@ -53,6 +53,16 @@ function BookingListItem(booking: BookingItemProps) {
}, },
}); });
const isUpcoming = new Date(booking.endTime) >= new Date();
const isPast = new Date(booking.endTime) < new Date();
const isCancelled = booking.status === BookingStatus.CANCELLED;
const isConfirmed = booking.status === BookingStatus.ACCEPTED;
const isRejected = booking.status === BookingStatus.REJECTED;
const isPending = booking.status === BookingStatus.PENDING;
const isRecurring = booking.recurringEventId !== null;
const isTabRecurring = booking.listingStatus === "recurring";
const isTabUnconfirmed = booking.listingStatus === "unconfirmed";
const bookingConfirm = async (confirm: boolean) => { const bookingConfirm = async (confirm: boolean) => {
let body = { let body = {
bookingId: booking.id, bookingId: booking.id,
@@ -69,16 +79,6 @@ function BookingListItem(booking: BookingItemProps) {
mutation.mutate(body); mutation.mutate(body);
}; };
const isUpcoming = new Date(booking.endTime) >= new Date();
const isPast = new Date(booking.endTime) < new Date();
const isCancelled = booking.status === BookingStatus.CANCELLED;
const isConfirmed = booking.status === BookingStatus.ACCEPTED;
const isRejected = booking.status === BookingStatus.REJECTED;
const isPending = booking.status === BookingStatus.PENDING;
const isRecurring = booking.recurringEventId !== null;
const isTabRecurring = booking.listingStatus === "recurring";
const isTabUnconfirmed = booking.listingStatus === "unconfirmed";
const pendingActions: ActionType[] = [ const pendingActions: ActionType[] = [
{ {
id: "reject", id: "reject",
+5 -17
View File
@@ -454,20 +454,12 @@ const loggedInViewerRouter = createProtectedRouter()
// handled separately for each occurrence // handled separately for each occurrence
OR: [ OR: [
{ {
AND: [ recurringEventId: { not: null },
{ NOT: { recurringEventId: { equals: null } } }, status: { notIn: [BookingStatus.PENDING, BookingStatus.CANCELLED, BookingStatus.REJECTED] },
{
status: {
notIn: [BookingStatus.PENDING, BookingStatus.CANCELLED, BookingStatus.REJECTED],
},
},
],
}, },
{ {
AND: [ recurringEventId: { equals: null },
{ recurringEventId: { equals: null } }, status: { notIn: [BookingStatus.CANCELLED, BookingStatus.REJECTED] },
{ status: { notIn: [BookingStatus.CANCELLED, BookingStatus.REJECTED] } },
],
}, },
], ],
}, },
@@ -495,13 +487,9 @@ const loggedInViewerRouter = createProtectedRouter()
endTime: { gte: new Date() }, endTime: { gte: new Date() },
OR: [ OR: [
{ {
AND: [ recurringEventId: { not: null },
{ NOT: { recurringEventId: { equals: null } } },
{
status: { equals: BookingStatus.PENDING }, status: { equals: BookingStatus.PENDING },
}, },
],
},
{ {
status: { equals: BookingStatus.PENDING }, status: { equals: BookingStatus.PENDING },
}, },