2021-05-12 16:13:03 +00:00
|
|
|
// @flow
|
|
|
|
|
2021-12-21 12:51:39 +00:00
|
|
|
import React, { useCallback, useState } from 'react';
|
2021-05-19 10:08:30 +00:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2022-01-12 16:29:58 +00:00
|
|
|
import { View } from 'react-native';
|
2021-05-26 07:15:37 +00:00
|
|
|
import { Button } from 'react-native-paper';
|
2021-06-11 13:12:00 +00:00
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
2021-05-12 16:13:03 +00:00
|
|
|
|
2022-06-20 14:53:19 +00:00
|
|
|
import { openDialog, openSheet } from '../../../base/dialog';
|
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';
|
2022-01-12 16:29:58 +00:00
|
|
|
import MuteEveryoneDialog
|
|
|
|
from '../../../video-menu/components/native/MuteEveryoneDialog';
|
2022-05-19 08:48:54 +00:00
|
|
|
import { isMoreActionsVisible, isMuteAllVisible } from '../../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-06-03 16:26:11 +00:00
|
|
|
import { ContextMenuMore } from './ContextMenuMore';
|
2021-09-22 14:05:42 +00:00
|
|
|
import HorizontalDotsIcon from './HorizontalDotsIcon';
|
2021-07-30 09:48:06 +00:00
|
|
|
import LobbyParticipantList from './LobbyParticipantList';
|
2021-08-04 08:51:05 +00:00
|
|
|
import MeetingParticipantList from './MeetingParticipantList';
|
2021-07-02 13:43:52 +00:00
|
|
|
import styles from './styles';
|
2021-05-14 16:03:23 +00:00
|
|
|
|
2021-05-12 16:13:03 +00:00
|
|
|
/**
|
|
|
|
* Participant pane.
|
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
2021-06-11 13:12:00 +00:00
|
|
|
const ParticipantsPane = () => {
|
2021-05-12 16:13:03 +00:00
|
|
|
const dispatch = useDispatch();
|
2021-12-21 12:51:39 +00:00
|
|
|
const [ searchString, setSearchString ] = useState('');
|
2022-06-20 14:53:19 +00:00
|
|
|
const openMoreMenu = useCallback(() => dispatch(openSheet(ContextMenuMore)), [ dispatch ]);
|
2021-06-09 15:35:58 +00:00
|
|
|
const isLocalModerator = useSelector(isLocalParticipantModerator);
|
2021-05-26 10:03:12 +00:00
|
|
|
const muteAll = useCallback(() => dispatch(openDialog(MuteEveryoneDialog)),
|
|
|
|
[ dispatch ]);
|
2021-05-19 10:08:30 +00:00
|
|
|
const { t } = useTranslation();
|
2021-05-14 16:03:23 +00:00
|
|
|
|
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);
|
|
|
|
const showMoreActions = useSelector(isMoreActionsVisible);
|
|
|
|
const showMuteAll = useSelector(isMuteAllVisible);
|
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-01-12 16:29:58 +00:00
|
|
|
<JitsiScreen style = { styles.participantsPaneContainer }>
|
|
|
|
<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-06-09 15:35:58 +00:00
|
|
|
{
|
2022-05-19 08:48:54 +00:00
|
|
|
isLocalModerator
|
2022-01-12 16:29:58 +00:00
|
|
|
&& <View style = { styles.participantsPaneFooter }>
|
2022-04-29 09:30:49 +00:00
|
|
|
{
|
|
|
|
showMuteAll && (
|
|
|
|
<Button
|
|
|
|
children = { t('participantsPane.actions.muteAll') }
|
|
|
|
labelStyle = { styles.muteAllLabel }
|
|
|
|
mode = 'contained'
|
|
|
|
onPress = { muteAll }
|
|
|
|
style = { styles.muteAllMoreButton } />
|
|
|
|
)
|
|
|
|
}
|
|
|
|
{
|
|
|
|
showMoreActions && (
|
|
|
|
<Button
|
|
|
|
icon = { HorizontalDotsIcon }
|
|
|
|
labelStyle = { styles.moreIcon }
|
|
|
|
mode = 'contained'
|
|
|
|
onPress = { openMoreMenu }
|
|
|
|
style = { styles.moreButton } />
|
|
|
|
)
|
|
|
|
}
|
2021-06-09 15:35:58 +00:00
|
|
|
</View>
|
|
|
|
}
|
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;
|