From 7b3ebb847ed1f572f86709534411691360531464 Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Sat, 22 Jan 2022 14:59:10 -0800 Subject: [PATCH] fixing dashboard layout and other things starting to implement rooms and all --- components/Dashboard/Office.tsx | 4 +-- components/Dashboard/Rooms.tsx | 2 +- components/Dashboard/TeamVoiceLine.tsx | 2 +- components/OfficeCard.tsx | 44 ++++++++++++++++++++++---- pages/teams/[teamid].tsx | 6 ++-- 5 files changed, 44 insertions(+), 14 deletions(-) diff --git a/components/Dashboard/Office.tsx b/components/Dashboard/Office.tsx index 8032c9f..1a112f2 100644 --- a/components/Dashboard/Office.tsx +++ b/components/Dashboard/Office.tsx @@ -81,7 +81,7 @@ export default function Office() { // if there are none, then show user button to create initial office rooms and then create them return ( -
+
Office @@ -89,7 +89,7 @@ export default function Office() { {/* all office rooms */} - + {allOfficeRooms.map((officeRoom) => ( ))} diff --git a/components/Dashboard/Rooms.tsx b/components/Dashboard/Rooms.tsx index 2385533..d8d7ce4 100644 --- a/components/Dashboard/Rooms.tsx +++ b/components/Dashboard/Rooms.tsx @@ -362,7 +362,7 @@ export default function DashboardRoom() { } return ( -
+
{/* modal for creating room */} +
TEAM diff --git a/components/OfficeCard.tsx b/components/OfficeCard.tsx index 99fd813..7ef6d15 100644 --- a/components/OfficeCard.tsx +++ b/components/OfficeCard.tsx @@ -1,30 +1,49 @@ import { Avatar } from "antd"; +import { useAuth } from "../contexts/authContext"; +import { useTeamDashboardContext } from "../contexts/teamDashboardContext"; import OfficeRoom, { OfficeRoomState } from "../models/officeRoom"; +import { User } from "../models/user"; interface IOfficeCard { officeRoom: OfficeRoom; } export default function OfficeCard(props: IOfficeCard) { + const { currUser } = useAuth(); + const { teamUsersMap, user } = useTeamDashboardContext(); + + var allMembersInRoom = props.officeRoom.members?.reduce((results, userId) => { + if (userId in teamUsersMap) { + results.push(teamUsersMap[userId]); + } + + if (userId == currUser.uid) { + results.push(user); + } + + return results; + }, [] as User[]); + return ( - {renderOfficePulse(OfficeRoomState.active)} + {renderOfficePulse(props.officeRoom.state)} {/* office location name */} - + {props.officeRoom.name} {/* all members in room */} - {props.officeRoom.members.map((officeLocation) => { + {allMembersInRoom.map((member) => { - {officeLocation[0]} + {member.nickName[0]} ; })} @@ -35,7 +54,18 @@ export default function OfficeCard(props: IOfficeCard) { } function renderOfficePulse(officeRoomState: OfficeRoomState) { - return ( - - ); + switch (officeRoomState) { + case OfficeRoomState.active: + return ( + + ); + case OfficeRoomState.idle: + return ( + + ); + default: + return ( + + ); + } } diff --git a/pages/teams/[teamid].tsx b/pages/teams/[teamid].tsx index 8872263..1980a96 100644 --- a/pages/teams/[teamid].tsx +++ b/pages/teams/[teamid].tsx @@ -85,14 +85,14 @@ function TeamDashboard() {
-
-
+
+
-
+