better concept with team rooms

This commit is contained in:
Arjun Patel
2022-01-17 16:05:27 -08:00
parent 8314251501
commit bc30fcf038
+15 -9
View File
@@ -25,7 +25,7 @@ import { Dropdown, Menu, Radio, Tooltip } from "antd";
import RoomCard from "../RoomCard"; import RoomCard from "../RoomCard";
enum RoomTypeFilter { enum RoomTypeFilter {
all = "all", team = "team",
me = "me", me = "me",
live = "live", live = "live",
archived = "archived", archived = "archived",
@@ -90,7 +90,7 @@ export default function DashboardRoom() {
// on CTRL + V, show modal to create meeting with the link // on CTRL + V, show modal to create meeting with the link
const [selectedTabPane, setSelectedTabPane] = useState<string>( const [selectedTabPane, setSelectedTabPane] = useState<string>(
RoomTypeFilter.all RoomTypeFilter.me
); );
// tab pane ui from scratch // tab pane ui from scratch
@@ -145,8 +145,12 @@ export default function DashboardRoom() {
// } // }
const allRooms = Array.from(roomsMap.values()); const allRooms = Array.from(roomsMap.values());
const meRooms = allRooms.filter((room) => const teamRooms = allRooms.filter(
room.members.includes(currUser.uid) (room) => room.status != RoomStatus.archived
);
const meRooms = allRooms.filter(
(room) =>
room.members.includes(currUser.uid) && room.status != RoomStatus.archived
); );
const liveRooms = allRooms.filter((room) => room.status == RoomStatus.live); const liveRooms = allRooms.filter((room) => room.status == RoomStatus.live);
@@ -157,8 +161,8 @@ export default function DashboardRoom() {
function getRoomContent() { function getRoomContent() {
// return data based on the selected filters // return data based on the selected filters
switch (selectedTabPane) { switch (selectedTabPane) {
case RoomTypeFilter.all: case RoomTypeFilter.team:
return allRooms; return teamRooms;
case RoomTypeFilter.me: case RoomTypeFilter.me:
return meRooms; return meRooms;
case RoomTypeFilter.live: case RoomTypeFilter.live:
@@ -204,9 +208,11 @@ export default function DashboardRoom() {
value={selectedTabPane} value={selectedTabPane}
onChange={(e) => setSelectedTabPane(e.target.value)} onChange={(e) => setSelectedTabPane(e.target.value)}
> >
<Radio.Button value={RoomTypeFilter.all}> <Radio.Button value={RoomTypeFilter.team}>
{RoomTypeFilter.all}{" "} {RoomTypeFilter.team}{" "}
<span className="text-xs text-orange-500">{allRooms.length}</span> <span className="text-xs text-orange-500">
{teamRooms.length}
</span>
</Radio.Button> </Radio.Button>
<Radio.Button value={RoomTypeFilter.me}> <Radio.Button value={RoomTypeFilter.me}>
{RoomTypeFilter.me}{" "} {RoomTypeFilter.me}{" "}