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.2KB

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