2021-05-12 16:13:03 +00:00
|
|
|
// @flow
|
|
|
|
|
2022-07-08 08:27:27 +00:00
|
|
|
import React, { useState } from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
2021-05-12 16:13:03 +00:00
|
|
|
|
2021-10-20 19:29:21 +00:00
|
|
|
import JitsiScreen from '../../../base/modal/components/JitsiScreen';
|
2022-04-29 09:30:49 +00:00
|
|
|
import { isLocalParticipantModerator } from '../../../base/participants';
|
2021-09-14 15:31:30 +00:00
|
|
|
import { equals } from '../../../base/redux';
|
2022-03-02 14:15:18 +00:00
|
|
|
import {
|
|
|
|
getBreakoutRooms,
|
|
|
|
getCurrentRoomId,
|
2022-04-29 09:30:49 +00:00
|
|
|
isAddBreakoutRoomButtonVisible,
|
|
|
|
isAutoAssignParticipantsVisible,
|
2022-03-02 14:15:18 +00:00
|
|
|
isInBreakoutRoom
|
|
|
|
} from '../../../breakout-rooms/functions';
|
2022-04-04 10:25:59 +00:00
|
|
|
import { getKnockingParticipants } from '../../../lobby/functions';
|
2021-09-14 15:31:30 +00:00
|
|
|
import {
|
|
|
|
AddBreakoutRoomButton,
|
|
|
|
AutoAssignButton,
|
|
|
|
LeaveBreakoutRoomButton
|
2022-01-12 16:29:58 +00:00
|
|
|
} from '../breakout-rooms/components/native';
|
|
|
|
import { CollapsibleRoom } from '../breakout-rooms/components/native/CollapsibleRoom';
|
2021-05-12 16:13:03 +00:00
|
|
|
|
2021-07-30 09:48:06 +00:00
|
|
|
import LobbyParticipantList from './LobbyParticipantList';
|
2021-08-04 08:51:05 +00:00
|
|
|
import MeetingParticipantList from './MeetingParticipantList';
|
2022-07-08 08:27:27 +00:00
|
|
|
import ParticipantsPaneFooter from './ParticipantsPaneFooter';
|
2021-07-02 13:43:52 +00:00
|
|
|
import styles from './styles';
|
2021-05-14 16:03:23 +00:00
|
|
|
|
2022-07-08 08:27:27 +00:00
|
|
|
|
2021-05-12 16:13:03 +00:00
|
|
|
/**
|
2022-07-08 08:27:27 +00:00
|
|
|
* Participants pane.
|
2021-05-12 16:13:03 +00:00
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
2021-06-11 13:12:00 +00:00
|
|
|
const ParticipantsPane = () => {
|
2021-12-21 12:51:39 +00:00
|
|
|
const [ searchString, setSearchString ] = useState('');
|
2021-06-09 15:35:58 +00:00
|
|
|
const isLocalModerator = useSelector(isLocalParticipantModerator);
|
2021-09-14 15:31:30 +00:00
|
|
|
const { conference } = useSelector(state => state['features/base/conference']);
|
|
|
|
const _isBreakoutRoomsSupported = conference?.getBreakoutRooms()?.isSupported();
|
|
|
|
const currentRoomId = useSelector(getCurrentRoomId);
|
|
|
|
const rooms: Array<Object> = Object.values(useSelector(getBreakoutRooms, equals))
|
|
|
|
.filter((room: Object) => room.id !== currentRoomId)
|
|
|
|
.sort((p1: Object, p2: Object) => (p1?.name || '').localeCompare(p2?.name || ''));
|
|
|
|
const inBreakoutRoom = useSelector(isInBreakoutRoom);
|
2022-04-29 09:30:49 +00:00
|
|
|
const showAddBreakoutRoom = useSelector(isAddBreakoutRoomButtonVisible);
|
|
|
|
const showAutoAssign = useSelector(isAutoAssignParticipantsVisible);
|
2022-03-25 09:09:55 +00:00
|
|
|
const lobbyParticipants = useSelector(getKnockingParticipants);
|
2021-09-14 15:31:30 +00:00
|
|
|
|
2021-05-12 16:13:03 +00:00
|
|
|
return (
|
2022-07-08 08:27:27 +00:00
|
|
|
<JitsiScreen
|
|
|
|
footerComponent = { isLocalModerator && ParticipantsPaneFooter }
|
|
|
|
style = { styles.participantsPaneContainer }>
|
2022-01-12 16:29:58 +00:00
|
|
|
<LobbyParticipantList />
|
|
|
|
<MeetingParticipantList
|
2022-04-04 10:25:59 +00:00
|
|
|
breakoutRooms = { rooms }
|
2022-04-12 11:45:27 +00:00
|
|
|
isLocalModerator = { isLocalModerator }
|
2022-04-04 10:25:59 +00:00
|
|
|
lobbyParticipants = { lobbyParticipants }
|
2022-01-12 16:29:58 +00:00
|
|
|
searchString = { searchString }
|
|
|
|
setSearchString = { setSearchString } />
|
|
|
|
{
|
2022-04-29 09:30:49 +00:00
|
|
|
showAutoAssign && <AutoAssignButton />
|
2022-01-12 16:29:58 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
inBreakoutRoom && <LeaveBreakoutRoomButton />
|
|
|
|
}
|
|
|
|
{
|
|
|
|
_isBreakoutRoomsSupported
|
|
|
|
&& rooms.map(room => (<CollapsibleRoom
|
|
|
|
key = { room.id }
|
|
|
|
room = { room }
|
|
|
|
searchString = { searchString } />))
|
|
|
|
}
|
|
|
|
{
|
2022-04-29 09:30:49 +00:00
|
|
|
showAddBreakoutRoom && <AddBreakoutRoomButton />
|
2022-01-12 16:29:58 +00:00
|
|
|
}
|
2021-10-20 19:29:21 +00:00
|
|
|
</JitsiScreen>
|
2021-05-12 16:13:03 +00:00
|
|
|
);
|
2021-06-11 13:12:00 +00:00
|
|
|
};
|
2021-05-12 16:13:03 +00:00
|
|
|
|
2021-06-11 13:12:00 +00:00
|
|
|
export default ParticipantsPane;
|