2021-05-12 16:13:03 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { useCallback } from 'react';
|
2021-05-19 10:08:30 +00:00
|
|
|
import { useTranslation } from 'react-i18next';
|
2021-09-01 23:13:16 +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
|
|
|
|
2021-06-11 13:12:00 +00:00
|
|
|
import { openDialog } from '../../../base/dialog';
|
2021-05-12 16:13:03 +00:00
|
|
|
import { JitsiModal } from '../../../base/modal';
|
2021-06-11 07:15:20 +00:00
|
|
|
import {
|
|
|
|
isLocalParticipantModerator
|
|
|
|
} from '../../../base/participants';
|
2021-05-26 10:03:12 +00:00
|
|
|
import MuteEveryoneDialog
|
|
|
|
from '../../../video-menu/components/native/MuteEveryoneDialog';
|
2021-06-11 13:12:00 +00:00
|
|
|
import { close } from '../../actions.native';
|
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-06-09 15:35:58 +00:00
|
|
|
const openMoreMenu = useCallback(() => dispatch(openDialog(ContextMenuMore)), [ dispatch ]);
|
2021-06-11 13:12:00 +00:00
|
|
|
const closePane = useCallback(() => dispatch(close()), [ 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-05-12 16:13:03 +00:00
|
|
|
return (
|
2021-06-11 13:12:00 +00:00
|
|
|
<JitsiModal
|
2021-07-30 13:26:07 +00:00
|
|
|
headerProps = {{
|
|
|
|
headerLabelKey: 'participantsPane.header'
|
|
|
|
}}
|
|
|
|
onClose = { closePane }
|
2021-05-14 16:03:23 +00:00
|
|
|
style = { styles.participantsPane }>
|
2021-09-01 23:13:16 +00:00
|
|
|
<LobbyParticipantList />
|
|
|
|
<MeetingParticipantList />
|
2021-06-09 15:35:58 +00:00
|
|
|
{
|
|
|
|
isLocalModerator
|
|
|
|
&& <View style = { styles.footer }>
|
|
|
|
<Button
|
|
|
|
children = { t('participantsPane.actions.muteAll') }
|
|
|
|
labelStyle = { styles.muteAllLabel }
|
|
|
|
mode = 'contained'
|
|
|
|
onPress = { muteAll }
|
2021-09-22 14:05:42 +00:00
|
|
|
style = { styles.muteAllMoreButton } />
|
|
|
|
<Button
|
|
|
|
icon = { HorizontalDotsIcon }
|
|
|
|
labelStyle = { styles.moreIcon }
|
|
|
|
mode = 'contained'
|
|
|
|
onPress = { openMoreMenu }
|
|
|
|
style = { styles.moreButton } />
|
2021-06-09 15:35:58 +00:00
|
|
|
</View>
|
|
|
|
}
|
2021-05-12 16:13:03 +00:00
|
|
|
</JitsiModal>
|
|
|
|
);
|
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;
|