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.

ContextMenuMore.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { TouchableOpacity } from 'react-native';
  5. import { Text } from 'react-native-paper';
  6. import { useDispatch, useSelector } from 'react-redux';
  7. import { openDialog, hideDialog } from '../../../base/dialog/actions';
  8. import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
  9. import {
  10. Icon,
  11. IconVideoOff
  12. } from '../../../base/icons';
  13. import {
  14. getLocalParticipant,
  15. getParticipantCount
  16. } from '../../../base/participants';
  17. import MuteEveryonesVideoDialog
  18. from '../../../video-menu/components/native/MuteEveryonesVideoDialog';
  19. import styles from './styles';
  20. export const ContextMenuMore = () => {
  21. const dispatch = useDispatch();
  22. const cancel = useCallback(() => dispatch(hideDialog()), [ dispatch ]);
  23. const { id } = useSelector(getLocalParticipant);
  24. const participantsCount = useSelector(getParticipantCount);
  25. const showSlidingView = participantsCount > 2;
  26. const muteAllVideo = useCallback(() =>
  27. dispatch(openDialog(MuteEveryonesVideoDialog,
  28. { exclude: [ id ] })),
  29. [ dispatch ]);
  30. const { t } = useTranslation();
  31. return (
  32. <BottomSheet
  33. addScrollViewPadding = { false }
  34. onCancel = { cancel }
  35. showSlidingView = { showSlidingView }
  36. style = { styles.contextMenuMore }>
  37. <TouchableOpacity
  38. onPress = { muteAllVideo }
  39. style = { styles.contextMenuItem }>
  40. <Icon
  41. size = { 24 }
  42. src = { IconVideoOff } />
  43. <Text style = { styles.contextMenuItemText }>{t('participantsPane.actions.stopEveryonesVideo')}</Text>
  44. </TouchableOpacity>
  45. </BottomSheet>
  46. );
  47. };