diff --git a/components/Dashboard/Rooms.tsx b/components/Dashboard/Rooms.tsx index baf33ef..febcf4f 100644 --- a/components/Dashboard/Rooms.tsx +++ b/components/Dashboard/Rooms.tsx @@ -200,6 +200,21 @@ export default function DashboardRoom() { ); }); + var relativeTimeNextMeeting = ""; + + // go through scheduled and find the first one coming up + if (scheduled && scheduled.length > 0) { + const firstOneInFuture = scheduled.find( + (room) => moment(room.scheduledDateTime.toDate()).diff(today) > 0 + ); + + if (firstOneInFuture) { + const meetingDatetime: Date = + firstOneInFuture.scheduledDateTime.toDate(); + relativeTimeNextMeeting = moment(meetingDatetime).fromNow(); + } + } + return ( <> @@ -226,6 +241,17 @@ export default function DashboardRoom() { roomType={RoomType.scheduled} /> + {relativeTimeNextMeeting ? ( + + {"You have your next one "}{" "} + + {relativeTimeNextMeeting} + + + ) : ( + <>> + )} +