diff --git a/components/Dashboard/Rooms.tsx b/components/Dashboard/Rooms.tsx
index bd42a5d..dfcbc73 100644
--- a/components/Dashboard/Rooms.tsx
+++ b/components/Dashboard/Rooms.tsx
@@ -157,20 +157,65 @@ export default function DashboardRoom() {
(room) => room.status == RoomStatus.archived
);
+ // data for different meRooms
+ const recurring = meRooms.filter(
+ (room) => room.type == RoomType.recurring && room.status == RoomStatus.empty
+ );
+ const now = meRooms.filter(
+ (room) =>
+ (room.type == RoomType.now && room.status != RoomStatus.archived) ||
+ room.status == RoomStatus.live
+ );
+ const scheduled = meRooms.filter(
+ (room) => room.type == RoomType.scheduled && room.status == RoomStatus.empty
+ );
+
+ // sorting array of scheduled rooms
+ scheduled.sort(function (a, b) {
+ // Turn your strings into dates, and then subtract them
+ // to get a value that is either negative, positive, or zero.
+ if (!b.scheduledDateTime) {
+ return -1;
+ }
+
+ return (
+ getTime(a.scheduledDateTime.toDate()) -
+ getTime(b.scheduledDateTime.toDate())
+ );
+ });
+
+ 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();
+ }
+ }
+
function getRoomContent() {
// return data based on the selected filters
switch (selectedTabPane) {
case RoomTypeFilter.team:
// render sections for different types
- const recurringTeam = meRooms.filter(
+ const recurringTeam = teamRooms.filter(
(room) =>
room.type == RoomType.recurring && room.status == RoomStatus.empty
);
- const nowTeam = meRooms.filter(
- (room) => room.status == RoomStatus.live
+
+ const nowTeam = teamRooms.filter(
+ (room) =>
+ (room.type == RoomType.now && room.status != RoomStatus.archived) ||
+ room.status == RoomStatus.live
);
- const scheduledTeam = meRooms.filter(
+
+ const scheduledTeam = teamRooms.filter(
(room) =>
room.type == RoomType.scheduled && room.status == RoomStatus.empty
);
@@ -191,13 +236,7 @@ export default function DashboardRoom() {
return (
<>
-
-