fixing dashboard layout and other things starting to implement rooms and all
This commit is contained in:
@@ -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
|
// if there are none, then show user button to create initial office rooms and then create them
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="p-5 flex flex-col bg-gray-100 bg-opacity-25 rounded-lg shadow-md w-96 shrink-0">
|
<section className="p-5 flex flex-col bg-gray-100 bg-opacity-25 rounded-lg shadow-md w-96 shrink-0 flex-1">
|
||||||
<span className="flex flex-row justify-start items-center pb-5">
|
<span className="flex flex-row justify-start items-center pb-5">
|
||||||
<span className="flex flex-col">
|
<span className="flex flex-col">
|
||||||
<span className="text-white uppercase">Office</span>
|
<span className="text-white uppercase">Office</span>
|
||||||
@@ -89,7 +89,7 @@ export default function Office() {
|
|||||||
</span>
|
</span>
|
||||||
|
|
||||||
{/* all office rooms */}
|
{/* all office rooms */}
|
||||||
<span className="flex flex-col space-y-5">
|
<span className="flex flex-col space-y-5 overflow-auto">
|
||||||
{allOfficeRooms.map((officeRoom) => (
|
{allOfficeRooms.map((officeRoom) => (
|
||||||
<OfficeCard key={officeRoom.id} officeRoom={officeRoom} />
|
<OfficeCard key={officeRoom.id} officeRoom={officeRoom} />
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ export default function DashboardRoom() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="p-5 flex flex-col bg-gray-100 bg-opacity-25 rounded-lg shadow-md h-[46rem] ">
|
<section className="p-5 flex flex-col bg-gray-100 bg-opacity-25 rounded-lg shadow-md flex-1">
|
||||||
{/* modal for creating room */}
|
{/* modal for creating room */}
|
||||||
<CreateOrUpdateRoom
|
<CreateOrUpdateRoom
|
||||||
show={showModalType == ShowModalType.createRoom}
|
show={showModalType == ShowModalType.createRoom}
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ export default function TeamVoiceLine() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="p-5 flex flex-col bg-gray-100 bg-opacity-25 rounded-lg shadow-md w-96 shrink-0">
|
<section className="p-5 flex flex-col bg-gray-100 bg-opacity-25 rounded-lg shadow-md w-96 shrink-0 max-h-[32rem]">
|
||||||
<span className="flex flex-row justify-start items-center pb-5">
|
<span className="flex flex-row justify-start items-center pb-5">
|
||||||
<span className="flex flex-col">
|
<span className="flex flex-col">
|
||||||
<span className="text-white">TEAM</span>
|
<span className="text-white">TEAM</span>
|
||||||
|
|||||||
@@ -1,30 +1,49 @@
|
|||||||
import { Avatar } from "antd";
|
import { Avatar } from "antd";
|
||||||
|
import { useAuth } from "../contexts/authContext";
|
||||||
|
import { useTeamDashboardContext } from "../contexts/teamDashboardContext";
|
||||||
import OfficeRoom, { OfficeRoomState } from "../models/officeRoom";
|
import OfficeRoom, { OfficeRoomState } from "../models/officeRoom";
|
||||||
|
import { User } from "../models/user";
|
||||||
|
|
||||||
interface IOfficeCard {
|
interface IOfficeCard {
|
||||||
officeRoom: OfficeRoom;
|
officeRoom: OfficeRoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function OfficeCard(props: IOfficeCard) {
|
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 (
|
return (
|
||||||
<span className="flex flex-col">
|
<span className="flex flex-col">
|
||||||
<span className="flex flex-row justify-start items-center">
|
<span className="flex flex-row justify-start items-center">
|
||||||
{renderOfficePulse(OfficeRoomState.active)}
|
{renderOfficePulse(props.officeRoom.state)}
|
||||||
|
|
||||||
{/* office location name */}
|
{/* office location name */}
|
||||||
<span className="text-gray-200 text-lg font-semibold ml-2">
|
<span className="text-gray-200 text-md font-semibold ml-2">
|
||||||
{props.officeRoom.name}
|
{props.officeRoom.name}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{/* all members in room */}
|
{/* all members in room */}
|
||||||
<span className="ml-auto">
|
<span className="ml-auto">
|
||||||
<Avatar.Group>
|
<Avatar.Group>
|
||||||
{props.officeRoom.members.map((officeLocation) => {
|
{allMembersInRoom.map((member) => {
|
||||||
<Avatar
|
<Avatar
|
||||||
|
src={member.avatarUrl}
|
||||||
style={{ backgroundColor: "teal", verticalAlign: "middle" }}
|
style={{ backgroundColor: "teal", verticalAlign: "middle" }}
|
||||||
className="shadow-xl hover:z-20 hover:cursor-pointer"
|
className="shadow-xl hover:z-20 hover:cursor-pointer"
|
||||||
>
|
>
|
||||||
{officeLocation[0]}
|
{member.nickName[0]}
|
||||||
</Avatar>;
|
</Avatar>;
|
||||||
})}
|
})}
|
||||||
</Avatar.Group>
|
</Avatar.Group>
|
||||||
@@ -35,7 +54,18 @@ export default function OfficeCard(props: IOfficeCard) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderOfficePulse(officeRoomState: OfficeRoomState) {
|
function renderOfficePulse(officeRoomState: OfficeRoomState) {
|
||||||
return (
|
switch (officeRoomState) {
|
||||||
<span className="h-4 w-4 rounded-full bg-green-500 animate-pulse shadow-lg"></span>
|
case OfficeRoomState.active:
|
||||||
);
|
return (
|
||||||
|
<span className="h-4 w-4 rounded-full bg-green-500 animate-pulse shadow-lg"></span>
|
||||||
|
);
|
||||||
|
case OfficeRoomState.idle:
|
||||||
|
return (
|
||||||
|
<span className="h-4 w-4 rounded-full bg-gray-400 animate-pulse shadow-lg"></span>
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return (
|
||||||
|
<span className="h-4 w-4 rounded-full bg-gray-400 animate-pulse shadow-lg"></span>
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,14 +85,14 @@ function TeamDashboard() {
|
|||||||
<div className="container mx-auto py-10 px-10 flex flex-col space-y-5">
|
<div className="container mx-auto py-10 px-10 flex flex-col space-y-5">
|
||||||
<Header />
|
<Header />
|
||||||
|
|
||||||
<div className="flex flex-row items-baseline space-x-5 space-y-5">
|
<div className="flex flex-row items-start space-x-5 h-[56rem]">
|
||||||
<div className="flex flex-col max-w-sm space-y-5">
|
<div className="flex flex-col max-w-sm space-y-5 h-full">
|
||||||
<TeamVoiceLine />
|
<TeamVoiceLine />
|
||||||
|
|
||||||
<Office />
|
<Office />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex flex-col space-y-5 flex-1 overflow-auto">
|
<div className="flex flex-col space-y-5 flex-1 h-full">
|
||||||
<Announcements />
|
<Announcements />
|
||||||
|
|
||||||
<Rooms />
|
<Rooms />
|
||||||
|
|||||||
Reference in New Issue
Block a user