diff --git a/frontend/src/components/RoomCard/RoomCard.tsx b/frontend/src/components/RoomCard/RoomCard.tsx
index 3fbc7c1..58e619b 100644
--- a/frontend/src/components/RoomCard/RoomCard.tsx
+++ b/frontend/src/components/RoomCard/RoomCard.tsx
@@ -88,7 +88,11 @@ export function getBookingTimeLeft(booking: Booking | undefined) {
if (booking === undefined) {
return 0;
}
- return Math.ceil(getTimeLeftMinutes(booking.endTime)) + 2;
+ // If the booking is ongoing, i.e start time is before "now", then do getTimeLeftMinutes
+ // Otherwise just get the total duration of the booking
+ return DateTime.fromISO(booking.startTime) <= DateTime.now()
+ ? Math.ceil(getTimeLeftMinutes(booking.endTime)) + 2
+ : getTimeDiff(booking.startTime, booking.endTime);
}
export function getTimeAvailableMinutes(booking: Booking | undefined) {
@@ -344,10 +348,7 @@ const ReservationStatusText = (props: {
@@ -460,64 +461,6 @@ const RoomCard = (props: RoomCardProps) => {
return defaultVars;
};
- const bookingTime = () => {
- if (isReserved) {
- if (booking?.resourceStatus === 'accepted') {
- if (DateTime.fromISO(booking.startTime) <= DateTime.now()) {
- return (
-
-
-
- Booked to you for {getBookingTimeLeft(booking)}{' '}
- minutes.
-
-
- );
- } else {
- return (
-
-
-
- Booked to you for{' '}
- {getTimeDiff(
- booking.startTime,
- booking.endTime
- )}{' '}
- minutes.
-
-
- );
- }
- } else {
- return (
-
-
-
- Waiting Google calendar confirmation.
-
-
- );
- }
- }
- return null;
- };
-
return (
{
/>
-
-
- {bookingTime()}
-
-