12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- // @flow
-
- import React, { useCallback } from 'react';
- import { useTranslation } from 'react-i18next';
- import { ScrollView, View } from 'react-native';
- import { Button } from 'react-native-paper';
- import { useDispatch, useSelector } from 'react-redux';
-
- import { openDialog } from '../../../base/dialog';
- import { Icon, IconClose, IconHorizontalPoints } from '../../../base/icons';
- import { JitsiModal } from '../../../base/modal';
- import {
- getParticipantCount,
- isLocalParticipantModerator
- } from '../../../base/participants';
- import MuteEveryoneDialog
- from '../../../video-menu/components/native/MuteEveryoneDialog';
- import { close } from '../../actions.native';
-
- import { ContextMenuMore } from './ContextMenuMore';
- import { LobbyParticipantList } from './LobbyParticipantList';
- import { MeetingParticipantList } from './MeetingParticipantList';
- import styles from './styles';
-
- /**
- * Participant pane.
- *
- * @returns {React$Element<any>}
- */
- const ParticipantsPane = () => {
- const dispatch = useDispatch();
- const openMoreMenu = useCallback(() => dispatch(openDialog(ContextMenuMore)), [ dispatch ]);
- const closePane = useCallback(() => dispatch(close()), [ dispatch ]);
- const isLocalModerator = useSelector(isLocalParticipantModerator);
- const participantsCount = useSelector(getParticipantCount);
- const showContextMenu = participantsCount > 2;
- const muteAll = useCallback(() => dispatch(openDialog(MuteEveryoneDialog)),
- [ dispatch ]);
- const { t } = useTranslation();
-
- return (
- <JitsiModal
- hideHeaderWithNavigation = { true }
- style = { styles.participantsPane }>
- <View style = { styles.header }>
- <Button
- /* eslint-disable-next-line react/jsx-no-bind */
- icon = { () =>
- (<Icon
- size = { 20 }
- src = { IconClose } />)
- }
- labelStyle = { styles.closeIcon }
- mode = 'contained'
- onPress = { closePane }
- style = { styles.closeButton } />
- </View>
- <ScrollView>
- <LobbyParticipantList />
- <MeetingParticipantList />
- </ScrollView>
- {
- isLocalModerator
- && <View style = { styles.footer }>
- <Button
- children = { t('participantsPane.actions.muteAll') }
- labelStyle = { styles.muteAllLabel }
- mode = 'contained'
- onPress = { muteAll }
- style = { showContextMenu ? styles.muteAllMoreButton : styles.muteAllButton } />
- {
- showContextMenu
- && <Button
- /* eslint-disable-next-line react/jsx-no-bind */
- icon = { () =>
- (<Icon
- size = { 20 }
- src = { IconHorizontalPoints } />)
- }
- labelStyle = { styles.moreIcon }
- mode = 'contained'
- onPress = { openMoreMenu }
- style = { styles.moreButton } />
- }
- </View>
- }
- </JitsiModal>
- );
- };
-
- export default ParticipantsPane;
|