You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ParticipantsPane.js 3.5KB

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