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

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