Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

VideoQualityLabel.web.tsx 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import React from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useDispatch, useSelector } from 'react-redux';
  4. import { IReduxState } from '../../app/types';
  5. import { openDialog } from '../../base/dialog/actions';
  6. import { IconPerformance } from '../../base/icons/svg';
  7. import Label from '../../base/label/components/web/Label';
  8. import { COLORS } from '../../base/label/constants';
  9. import Tooltip from '../../base/tooltip/components/Tooltip';
  10. import { shouldDisplayTileView } from '../../video-layout/functions.web';
  11. import VideoQualityDialog from './VideoQualityDialog.web';
  12. /**
  13. * React {@code Component} responsible for displaying a label that indicates
  14. * the displayed video state of the current conference. {@code AudioOnlyLabel}
  15. * Will display when the conference is in audio only mode. {@code HDVideoLabel}
  16. * Will display if not in audio only mode and a high-definition large video is
  17. * being displayed.
  18. *
  19. * @returns {JSX}
  20. */
  21. const VideoQualityLabel = () => {
  22. const _audioOnly = useSelector((state: IReduxState) => state['features/base/audio-only'].enabled);
  23. const _visible = useSelector((state: IReduxState) => !(shouldDisplayTileView(state)
  24. || interfaceConfig.VIDEO_QUALITY_LABEL_DISABLED));
  25. const dispatch = useDispatch();
  26. const { t } = useTranslation();
  27. if (!_visible) {
  28. return null;
  29. }
  30. let className, icon, labelContent, tooltipKey;
  31. if (_audioOnly) {
  32. className = 'audio-only';
  33. labelContent = t('videoStatus.audioOnly');
  34. tooltipKey = 'videoStatus.labelTooltipAudioOnly';
  35. } else {
  36. className = 'current-video-quality';
  37. icon = IconPerformance;
  38. tooltipKey = 'videoStatus.performanceSettings';
  39. }
  40. const onClick = () => dispatch(openDialog(VideoQualityDialog));
  41. return (
  42. <Tooltip
  43. content = { t(tooltipKey) }
  44. position = { 'bottom' }>
  45. <Label
  46. accessibilityText = { t(tooltipKey) }
  47. className = { className }
  48. color = { COLORS.white }
  49. icon = { icon }
  50. iconColor = '#fff'
  51. id = 'videoResolutionLabel'
  52. // eslint-disable-next-line react/jsx-no-bind
  53. onClick = { onClick }
  54. text = { labelContent } />
  55. </Tooltip>
  56. );
  57. };
  58. export default VideoQualityLabel;