diff --git a/src/components/home/MeetingsPanel.tsx b/src/components/home/MeetingsPanel.tsx index 96c7dca..5fc25bf 100644 --- a/src/components/home/MeetingsPanel.tsx +++ b/src/components/home/MeetingsPanel.tsx @@ -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 (
@@ -23,16 +37,22 @@ const MeetingsPanel: React.FC = () => {
{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(new Date()); useEffect(() => { - setInterval(() => setCurrentDate(new Date()), 1000); + setInterval(() => setCurrentDate(new Date()), 30000); }, []); const currentDatemil = currentDate.getTime();