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.

Labels.native.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. // @flow
  2. import React from 'react';
  3. import { View } from 'react-native';
  4. import { connect } from 'react-redux';
  5. import { JitsiRecordingConstants } from '../../base/lib-jitsi-meet';
  6. import {
  7. isNarrowAspectRatio,
  8. makeAspectRatioAware
  9. } from '../../base/responsive-ui';
  10. import AbstractLabels, {
  11. _abstractMapStateToProps,
  12. type Props as AbstractLabelsProps
  13. } from './AbstractLabels';
  14. import styles from './styles';
  15. /**
  16. * The type of the React {@code Component} props of {@link Labels}.
  17. */
  18. type Props = AbstractLabelsProps & {
  19. /**
  20. * The indicator which determines whether the UI is reduced (to accommodate
  21. * smaller display areas).
  22. *
  23. * @private
  24. */
  25. _reducedUI: boolean
  26. };
  27. /**
  28. * A container that renders the conference indicators, if any.
  29. */
  30. class Labels extends AbstractLabels<Props, *> {
  31. /**
  32. * Implements React {@code Component}'s render.
  33. *
  34. * @inheritdoc
  35. */
  36. render() {
  37. const wide = !isNarrowAspectRatio(this);
  38. const { _filmstripVisible, _reducedUI } = this.props;
  39. return (
  40. <View
  41. pointerEvents = 'box-none'
  42. style = { [
  43. styles.indicatorContainer,
  44. wide && _filmstripVisible && styles.indicatorContainerWide
  45. ] }>
  46. {
  47. this._renderRecordingLabel(
  48. JitsiRecordingConstants.mode.FILE)
  49. }
  50. {
  51. this._renderRecordingLabel(
  52. JitsiRecordingConstants.mode.STREAM)
  53. }
  54. {
  55. this._renderTranscribingLabel()
  56. }
  57. {/*
  58. * Emil, Lyubomir, Nichole, and Zoli said that the Labels
  59. * should not be rendered in Picture-in-Picture. Saul argued
  60. * that the recording Labels should be rendered. As a temporary
  61. * compromise, don't render the VideoQualityLabel at least
  62. * because it's not that important.
  63. */
  64. _reducedUI || this._renderVideoQualityLabel()
  65. }
  66. </View>
  67. );
  68. }
  69. _renderRecordingLabel: string => React$Element<*>;
  70. _renderTranscribingLabel: () => React$Element<*>
  71. _renderVideoQualityLabel: () => React$Element<*>;
  72. }
  73. /**
  74. * Maps (parts of) the redux state to the associated
  75. * {@code Labels}'s props.
  76. *
  77. * @param {Object} state - The redux state.
  78. * @private
  79. * @returns {{
  80. * _filmstripVisible: boolean,
  81. * _reducedUI: boolean
  82. * }}
  83. */
  84. function _mapStateToProps(state) {
  85. return {
  86. ..._abstractMapStateToProps(state),
  87. _reducedUI: state['features/base/responsive-ui'].reducedUI
  88. };
  89. }
  90. export default connect(_mapStateToProps)(makeAspectRatioAware(Labels));