changing back to better ui from before

This commit is contained in:
Arjun Patel
2022-01-20 15:07:05 -08:00
parent f23e92a704
commit 5409cb8d12
3 changed files with 74 additions and 129 deletions
+64 -125
View File
@@ -157,20 +157,65 @@ export default function DashboardRoom() {
(room) => room.status == RoomStatus.archived (room) => room.status == RoomStatus.archived
); );
// data for different meRooms
const recurring = meRooms.filter(
(room) => room.type == RoomType.recurring && room.status == RoomStatus.empty
);
const now = meRooms.filter(
(room) =>
(room.type == RoomType.now && room.status != RoomStatus.archived) ||
room.status == RoomStatus.live
);
const scheduled = meRooms.filter(
(room) => room.type == RoomType.scheduled && room.status == RoomStatus.empty
);
// sorting array of scheduled rooms
scheduled.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())
);
});
var relativeTimeNextMeeting = "";
// go through scheduled and find the first one coming up
if (scheduled && scheduled.length > 0) {
const firstOneInFuture = scheduled.find(
(room) => moment(room.scheduledDateTime.toDate()).diff(today) > 0
);
if (firstOneInFuture) {
const meetingDatetime: Date = firstOneInFuture.scheduledDateTime.toDate();
relativeTimeNextMeeting = moment(meetingDatetime).fromNow();
}
}
function getRoomContent() { function getRoomContent() {
// return data based on the selected filters // return data based on the selected filters
switch (selectedTabPane) { switch (selectedTabPane) {
case RoomTypeFilter.team: case RoomTypeFilter.team:
// render sections for different types // render sections for different types
const recurringTeam = meRooms.filter( const recurringTeam = teamRooms.filter(
(room) => (room) =>
room.type == RoomType.recurring && room.status == RoomStatus.empty room.type == RoomType.recurring && room.status == RoomStatus.empty
); );
const nowTeam = meRooms.filter(
(room) => room.status == RoomStatus.live const nowTeam = teamRooms.filter(
(room) =>
(room.type == RoomType.now && room.status != RoomStatus.archived) ||
room.status == RoomStatus.live
); );
const scheduledTeam = meRooms.filter(
const scheduledTeam = teamRooms.filter(
(room) => (room) =>
room.type == RoomType.scheduled && room.status == RoomStatus.empty room.type == RoomType.scheduled && room.status == RoomStatus.empty
); );
@@ -191,13 +236,7 @@ export default function DashboardRoom() {
return ( return (
<> <>
<span className="flex flex-row justify-start"> <div className="flex flex-row flex-wrap">
<RoomTypeTag
roomStatus={RoomStatus.live}
roomType={RoomType.now}
/>
</span>
<div className="flex flex-row overflow-x-auto">
{nowTeam.map((room) => ( {nowTeam.map((room) => (
<RoomCard <RoomCard
key={room.id} key={room.id}
@@ -205,28 +244,7 @@ export default function DashboardRoom() {
updateRoomHandler={handleUpdateRoom} updateRoomHandler={handleUpdateRoom}
/> />
))} ))}
</div>
<Divider className="bg-gray-400" />
<span className="flex flex-row justify-start">
<RoomTypeTag
roomStatus={RoomStatus.empty}
roomType={RoomType.scheduled}
/>
</span>
{relativeTimeNextMeeting ? (
<span>
{"You have your next one "}{" "}
<span className="text-orange-500">
{relativeTimeNextMeeting}
</span>
</span>
) : (
<></>
)}
<div className="flex flex-row overflow-x-auto">
{scheduledTeam.map((room) => ( {scheduledTeam.map((room) => (
<RoomCard <RoomCard
key={room.id} key={room.id}
@@ -234,17 +252,7 @@ export default function DashboardRoom() {
updateRoomHandler={handleUpdateRoom} updateRoomHandler={handleUpdateRoom}
/> />
))} ))}
</div>
<Divider className="bg-gray-400" />
<span className="flex flex-row justify-start">
<RoomTypeTag
roomStatus={RoomStatus.empty}
roomType={RoomType.recurring}
/>
</span>
<div className="flex flex-row overflow-x-auto">
{recurringTeam.map((room) => ( {recurringTeam.map((room) => (
<RoomCard <RoomCard
key={room.id} key={room.id}
@@ -257,56 +265,9 @@ export default function DashboardRoom() {
); );
case RoomTypeFilter.me: case RoomTypeFilter.me:
// render sections for different types
const recurring = meRooms.filter(
(room) =>
room.type == RoomType.recurring && room.status == RoomStatus.empty
);
const now = meRooms.filter((room) => room.status == RoomStatus.live);
const scheduled = meRooms.filter(
(room) =>
room.type == RoomType.scheduled && room.status == RoomStatus.empty
);
// sorting array of scheduled rooms
scheduled.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())
);
});
var relativeTimeNextMeeting = "";
// go through scheduled and find the first one coming up
if (scheduled && scheduled.length > 0) {
const firstOneInFuture = scheduled.find(
(room) => moment(room.scheduledDateTime.toDate()).diff(today) > 0
);
if (firstOneInFuture) {
const meetingDatetime: Date =
firstOneInFuture.scheduledDateTime.toDate();
relativeTimeNextMeeting = moment(meetingDatetime).fromNow();
}
}
return ( return (
<> <>
<span className="flex flex-row justify-start"> <div className="flex flex-row flex-wrap">
<RoomTypeTag
roomStatus={RoomStatus.live}
roomType={RoomType.now}
/>
</span>
<div className="flex flex-row overflow-x-auto">
{now.map((room) => ( {now.map((room) => (
<RoomCard <RoomCard
key={room.id} key={room.id}
@@ -314,29 +275,7 @@ export default function DashboardRoom() {
updateRoomHandler={handleUpdateRoom} updateRoomHandler={handleUpdateRoom}
/> />
))} ))}
</div>
<Divider className="bg-gray-400" />
<span className="flex flex-row justify-start">
<RoomTypeTag
roomStatus={RoomStatus.empty}
roomType={RoomType.scheduled}
/>
</span>
{relativeTimeNextMeeting ? (
<span>
{"You have your next one "}{" "}
<span className="text-orange-500">
{relativeTimeNextMeeting}
{"."}
</span>
</span>
) : (
<></>
)}
<div className="flex flex-row overflow-x-auto">
{scheduled.map((room) => ( {scheduled.map((room) => (
<RoomCard <RoomCard
key={room.id} key={room.id}
@@ -344,17 +283,7 @@ export default function DashboardRoom() {
updateRoomHandler={handleUpdateRoom} updateRoomHandler={handleUpdateRoom}
/> />
))} ))}
</div>
<Divider className="bg-gray-400" />
<span className="flex flex-row justify-start">
<RoomTypeTag
roomStatus={RoomStatus.empty}
roomType={RoomType.recurring}
/>
</span>
<div className="flex flex-row overflow-x-auto">
{recurring.map((room) => ( {recurring.map((room) => (
<RoomCard <RoomCard
key={room.id} key={room.id}
@@ -430,7 +359,7 @@ export default function DashboardRoom() {
} }
return ( return (
<section className="p-5 flex flex-col bg-gray-100 bg-opacity-25 rounded-lg shadow-md"> <section className="p-5 flex flex-col bg-gray-100 bg-opacity-25 rounded-lg shadow-md h-[46rem] ">
{/* modal for creating room */} {/* modal for creating room */}
<CreateOrUpdateRoom <CreateOrUpdateRoom
show={showModalType == ShowModalType.createRoom} show={showModalType == ShowModalType.createRoom}
@@ -452,7 +381,17 @@ export default function DashboardRoom() {
CTRL + Q CTRL + Q
</button> </button>
</span> </span>
<span className="text-gray-300 text-xs"></span> {relativeTimeNextMeeting ? (
<span className="text-gray-300 text-xs">
{"You have your next one "}{" "}
<span className="text-orange-500">
{relativeTimeNextMeeting}
{"."}
</span>
</span>
) : (
<></>
)}
</span> </span>
<Radio.Group <Radio.Group
@@ -500,7 +439,7 @@ export default function DashboardRoom() {
</Tooltip> </Tooltip>
{/* all rooms */} {/* all rooms */}
<span className="h-[32rem] overflow-auto">{getRoomContent()}</span> <span className="overflow-auto">{getRoomContent()}</span>
</section> </section>
); );
} }
+5
View File
@@ -303,6 +303,11 @@ export default function RoomCard(props: IRoomCardProps) {
{/* room status and link(s) */} {/* room status and link(s) */}
<span className="flex flex-col items-end justify-between h-full w-fit"> <span className="flex flex-col items-end justify-between h-full w-fit">
<RoomTypeTag
roomStatus={props.room.status}
roomType={props.room.type}
/>
{renderTopRightCardInfo()} {renderTopRightCardInfo()}
<span <span
+5 -4
View File
@@ -39,10 +39,11 @@ export default function RoomTypeTag(props: RoomTypeTagProps) {
case RoomType.scheduled: case RoomType.scheduled:
return ( return (
<span className={"text-blue-700 bg-blue-200 " + universalClassNames}> <></>
<FaClock /> // <span className={"text-blue-700 bg-blue-200 " + universalClassNames}>
<span>scheduled</span> // <FaClock />
</span> // <span>scheduled</span>
// </span>
); );
case RoomType.recurring: case RoomType.recurring: