您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ParticipantsPane.js 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { ScrollView, View } from 'react-native';
  5. import { Button } from 'react-native-paper';
  6. import { useDispatch, useSelector } from 'react-redux';
  7. import { openDialog } from '../../../base/dialog';
  8. import { Icon, IconHorizontalPoints } from '../../../base/icons';
  9. import { JitsiModal } from '../../../base/modal';
  10. import {
  11. getParticipantCount,
  12. isLocalParticipantModerator
  13. } from '../../../base/participants';
  14. import MuteEveryoneDialog
  15. from '../../../video-menu/components/native/MuteEveryoneDialog';
  16. import { close } from '../../actions.native';
  17. import { ContextMenuMore } from './ContextMenuMore';
  18. import LobbyParticipantList from './LobbyParticipantList';
  19. import MeetingParticipantList from './MeetingParticipantList';
  20. import styles from './styles';
  21. /**
  22. * Participant pane.
  23. *
  24. * @returns {React$Element<any>}
  25. */
  26. const ParticipantsPane = () => {
  27. const dispatch = useDispatch();
  28. const openMoreMenu = useCallback(() => dispatch(openDialog(ContextMenuMore)), [ dispatch ]);
  29. const closePane = useCallback(() => dispatch(close()), [ dispatch ]);
  30. const isLocalModerator = useSelector(isLocalParticipantModerator);
  31. const participantsCount = useSelector(getParticipantCount);
  32. const showContextMenu = participantsCount > 2;
  33. const muteAll = useCallback(() => dispatch(openDialog(MuteEveryoneDialog)),
  34. [ dispatch ]);
  35. const { t } = useTranslation();
  36. return (
  37. <JitsiModal
  38. headerProps = {{
  39. headerLabelKey: 'participantsPane.header'
  40. }}
  41. onClose = { closePane }
  42. style = { styles.participantsPane }>
  43. <ScrollView>
  44. <LobbyParticipantList />
  45. <MeetingParticipantList />
  46. </ScrollView>
  47. {
  48. isLocalModerator
  49. && <View style = { styles.footer }>
  50. <Button
  51. children = { t('participantsPane.actions.muteAll') }
  52. labelStyle = { styles.muteAllLabel }
  53. mode = 'contained'
  54. onPress = { muteAll }
  55. style = { showContextMenu ? styles.muteAllMoreButton : styles.muteAllButton } />
  56. {
  57. showContextMenu
  58. && <Button
  59. /* eslint-disable-next-line react/jsx-no-bind */
  60. icon = { () =>
  61. (<Icon
  62. size = { 20 }
  63. src = { IconHorizontalPoints } />)
  64. }
  65. labelStyle = { styles.moreIcon }
  66. mode = 'contained'
  67. onPress = { openMoreMenu }
  68. style = { styles.moreButton } />
  69. }
  70. </View>
  71. }
  72. </JitsiModal>
  73. );
  74. };
  75. export default ParticipantsPane;