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

ParticipantsPane.js 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { useDispatch, useSelector } from 'react-redux';
  5. import { ThemeProvider } from 'styled-components';
  6. import { openDialog } from '../../base/dialog';
  7. import { isLocalParticipantModerator } from '../../base/participants';
  8. import { MuteEveryoneDialog } from '../../video-menu/components/';
  9. import { close } from '../actions';
  10. import { classList, getParticipantsPaneOpen } from '../functions';
  11. import theme from '../theme.json';
  12. import { LobbyParticipantList } from './LobbyParticipantList';
  13. import { MeetingParticipantList } from './MeetingParticipantList';
  14. import {
  15. AntiCollapse,
  16. Close,
  17. Container,
  18. Footer,
  19. FooterButton,
  20. Header
  21. } from './styled';
  22. export const ParticipantsPane = () => {
  23. const dispatch = useDispatch();
  24. const paneOpen = useSelector(getParticipantsPaneOpen);
  25. const isLocalModerator = useSelector(isLocalParticipantModerator);
  26. const { t } = useTranslation();
  27. const closePane = useCallback(() => dispatch(close(), [ dispatch ]));
  28. const closePaneKeyPress = useCallback(e => {
  29. if (closePane && (e.key === ' ' || e.key === 'Enter')) {
  30. e.preventDefault();
  31. closePane();
  32. }
  33. }, [ closePane ]);
  34. const muteAll = useCallback(() => dispatch(openDialog(MuteEveryoneDialog)), [ dispatch ]);
  35. return (
  36. <ThemeProvider theme = { theme }>
  37. <div
  38. className = { classList(
  39. 'participants_pane',
  40. !paneOpen && 'participants_pane--closed'
  41. ) }>
  42. <div className = 'participants_pane-content'>
  43. <Header>
  44. <Close
  45. aria-label = { t('participantsPane.close', 'Close') }
  46. onClick = { closePane }
  47. onKeyPress = { closePaneKeyPress }
  48. role = 'button'
  49. tabIndex = { 0 } />
  50. </Header>
  51. <Container>
  52. <LobbyParticipantList />
  53. <AntiCollapse />
  54. <MeetingParticipantList />
  55. </Container>
  56. {isLocalModerator && (
  57. <Footer>
  58. <FooterButton onClick = { muteAll }>
  59. {t('participantsPane.actions.muteAll')}
  60. </FooterButton>
  61. </Footer>
  62. )}
  63. </div>
  64. </div>
  65. </ThemeProvider>
  66. );
  67. };