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 { selectMeetings } from "../../redux/slices/meetingsAndUserStatusSlice";
|
||||||
import { selectUsers } from "../../redux/slices/usersSlice";
|
import { selectUsers } from "../../redux/slices/usersSlice";
|
||||||
import { formatTimeFromDate } from "../../utils";
|
import { formatTimeFromDate } from "../../utils";
|
||||||
|
import UserLite from "../../api-bodies/UserLite";
|
||||||
|
|
||||||
const MeetingsPanel: React.FC = () => {
|
const MeetingsPanel: React.FC = () => {
|
||||||
|
|
||||||
const meetings = useAppSelector(selectMeetings);
|
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 (
|
return (
|
||||||
<div className="meetings-panel">
|
<div className="meetings-panel">
|
||||||
@ -23,16 +37,22 @@ const MeetingsPanel: React.FC = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{meetings.map((meeting) => {
|
{meetings.map((meeting) => {
|
||||||
const meetingMembers = useAppSelector((state) =>
|
// const meetingMembers = useAppSelector((state) =>
|
||||||
selectUsers(state, meeting.liveParticipantIds)
|
// 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 startDate = new Date(meeting.start);
|
||||||
const startDatemil = startDate.getTime();
|
const startDatemil = startDate.getTime();
|
||||||
const endDatemil = startDatemil + meeting.duration*60000;
|
const endDatemil = startDatemil + meeting.duration*60000;
|
||||||
const endDate = new Date(endDatemil);
|
const endDate = new Date(endDatemil);
|
||||||
const [currentDate, setCurrentDate] = useState<Date>(new Date());
|
const [currentDate, setCurrentDate] = useState<Date>(new Date());
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setInterval(() => setCurrentDate(new Date()), 1000);
|
setInterval(() => setCurrentDate(new Date()), 30000);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const currentDatemil = currentDate.getTime();
|
const currentDatemil = currentDate.getTime();
|
||||||
|
|||||||
Reference in New Issue
Block a user