trying to fix meetings panel (still have bug)
This commit is contained in:
parent
6260910d47
commit
5119cd5272
@ -5,10 +5,24 @@ import { useAppSelector } from "../../redux/hooks";
|
||||
import { selectMeetings } from "../../redux/slices/meetingsAndUserStatusSlice";
|
||||
import { selectUsers } from "../../redux/slices/usersSlice";
|
||||
import { formatTimeFromDate } from "../../utils";
|
||||
import UserLite from "../../api-bodies/UserLite";
|
||||
|
||||
const MeetingsPanel: React.FC = () => {
|
||||
|
||||
const meetings = useAppSelector(selectMeetings);
|
||||
let uuids: string[] = [];
|
||||
meetings.forEach((meeting) => {
|
||||
meeting.liveParticipantIds.forEach((uuid) => {
|
||||
if(!uuids.includes(uuid)) {
|
||||
uuids.push(uuid);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const participants: UserLite[] = useAppSelector((state) =>
|
||||
selectUsers(state, uuids)
|
||||
);
|
||||
|
||||
|
||||
return (
|
||||
<div className="meetings-panel">
|
||||
@ -23,16 +37,22 @@ const MeetingsPanel: React.FC = () => {
|
||||
</div>
|
||||
|
||||
{meetings.map((meeting) => {
|
||||
const meetingMembers = useAppSelector((state) =>
|
||||
selectUsers(state, meeting.liveParticipantIds)
|
||||
);
|
||||
// const meetingMembers = useAppSelector((state) =>
|
||||
// selectUsers(state, meeting.liveParticipantIds)
|
||||
// );
|
||||
const meetingMembers: UserLite[] = [];
|
||||
participants.forEach((userLite) => {
|
||||
if (meeting.liveParticipantIds.includes(userLite.uuid)) {
|
||||
meetingMembers.push(userLite);
|
||||
}
|
||||
});
|
||||
const startDate = new Date(meeting.start);
|
||||
const startDatemil = startDate.getTime();
|
||||
const endDatemil = startDatemil + meeting.duration*60000;
|
||||
const endDate = new Date(endDatemil);
|
||||
const [currentDate, setCurrentDate] = useState<Date>(new Date());
|
||||
useEffect(() => {
|
||||
setInterval(() => setCurrentDate(new Date()), 1000);
|
||||
setInterval(() => setCurrentDate(new Date()), 30000);
|
||||
}, []);
|
||||
|
||||
const currentDatemil = currentDate.getTime();
|
||||
|
||||
Reference in New Issue
Block a user