diff --git a/components/Dashboard/Rooms.tsx b/components/Dashboard/Rooms.tsx index febcf4f..afa54d6 100644 --- a/components/Dashboard/Rooms.tsx +++ b/components/Dashboard/Rooms.tsx @@ -163,16 +163,101 @@ export default function DashboardRoom() { // return data based on the selected filters switch (selectedTabPane) { case RoomTypeFilter.team: - return teamRooms.map((room) => { - // if the room is + // render sections for different types + + const recurringTeam = meRooms.filter( + (room) => + room.type == RoomType.recurring && room.status == RoomStatus.empty + ); + const nowTeam = meRooms.filter( + (room) => room.status == RoomStatus.live + ); + const scheduledTeam = meRooms.filter( + (room) => + room.type == RoomType.scheduled && room.status == RoomStatus.empty + ); + + // sorting array of scheduled rooms + scheduledTeam.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()) ); }); + + return ( + <> + + + +
+ {nowTeam.map((room) => ( + + ))} +
+ + + + + + + {relativeTimeNextMeeting ? ( + + {"You have your next one "}{" "} + + {relativeTimeNextMeeting} + + + ) : ( + <> + )} + +
+ {scheduledTeam.map((room) => ( + + ))} +
+ + + + + + +
+ {recurringTeam.map((room) => ( + + ))} +
+ + ); + case RoomTypeFilter.me: // render sections for different types @@ -282,15 +367,6 @@ export default function DashboardRoom() { ); - // return meRooms.map((room) => { - // return ( - // - // ); - // }); case RoomTypeFilter.live: return liveRooms.map((room) => { // if the room is