diff --git a/frontend-next/src/components/app/datatypes.js b/frontend-next/src/components/app/datatypes.js index 343c23d..b6f217f 100644 --- a/frontend-next/src/components/app/datatypes.js +++ b/frontend-next/src/components/app/datatypes.js @@ -1,6 +1,9 @@ import Link from "next/link" import { useEffect, useState } from "react"; +// Icons +import PersonIcon from '@mui/icons-material/Person'; + // Colors for Messages const userColors = [ "#ff80ed", @@ -160,12 +163,34 @@ export function Member({ memberObj }) { * @returns {Object} - Chat Room Component */ export function ChatRoomSidebar({ roomObj }) { + if ("users" in roomObj) { + if ("online" in roomObj.users) { + var roomOnline = Object.keys(roomObj.users.online).length + } else { + var roomOnline = 0 + } + if ("all" in roomObj.users) { + var roomTotal = Object.keys(roomObj.users.all).length + } else { + var roomTotal = 0 + } + } else { + var roomOnline = 0 + var roomTotal = 0 + } + console.log(roomObj) return (
-
-
{roomObj.name}
-
{roomObj.description}
+
+
+ +
{roomOnline} / {roomTotal}
+
+
+
{roomObj.name}
+
{roomObj.description}
+
diff --git a/frontend-next/src/components/app/sidebar/home.js b/frontend-next/src/components/app/sidebar/home.js index 5f5d04e..74ad684 100644 --- a/frontend-next/src/components/app/sidebar/home.js +++ b/frontend-next/src/components/app/sidebar/home.js @@ -88,13 +88,15 @@ export function Sidebar({user,location,loadingLoc}) { // Add myRooms to Sidebar var myRoomArr = []; for (var room in user.rooms) { - var newRoom = ( - - ); - myRoomArr.push(newRoom); + get(ref(database, `/rooms/${user.rooms[room].path}/${user.rooms[room].name}-${user.rooms[room].timestamp}`)).then((snapshot) => { + var newRoom = ( + + ); + myRoomArr.push(newRoom); + }) } useEffect(() => {