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.js 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // @flow
  2. import React from 'react';
  3. import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
  4. import { connect } from '../../../base/redux';
  5. import AbstractLabels, {
  6. _abstractMapStateToProps as _mapStateToProps,
  7. type Props
  8. } from '../AbstractLabels';
  9. declare var interfaceConfig: Object;
  10. /**
  11. * The type of the React {@code Component} state of {@link Labels}.
  12. */
  13. type State = {
  14. /**
  15. * Whether or not the filmstrip was not visible but has transitioned in the
  16. * latest component update to visible. This boolean is used to set a class
  17. * for position animations.
  18. *
  19. * @type {boolean}
  20. */
  21. filmstripBecomingVisible: boolean
  22. };
  23. /**
  24. * A container to hold video status labels, including recording status and
  25. * current large video quality.
  26. *
  27. * @extends Component
  28. */
  29. class Labels extends AbstractLabels<Props, State> {
  30. /**
  31. * Updates the state for whether or not the filmstrip is transitioning to
  32. * a displayed state.
  33. *
  34. * @inheritdoc
  35. */
  36. static getDerivedStateFromProps(props: Props, prevState: State) {
  37. return {
  38. filmstripBecomingVisible: !prevState.filmstripBecomingVisible && props._filmstripVisible
  39. };
  40. }
  41. /**
  42. * Initializes a new {@code Labels} instance.
  43. *
  44. * @param {Object} props - The read-only properties with which the new
  45. * instance is to be initialized.
  46. */
  47. constructor(props: Props) {
  48. super(props);
  49. this.state = {
  50. filmstripBecomingVisible: false
  51. };
  52. }
  53. /**
  54. * Implements React's {@link Component#render()}.
  55. *
  56. * @inheritdoc
  57. * @returns {ReactElement}
  58. */
  59. render() {
  60. const { _filmstripVisible } = this.props;
  61. const { filmstripBecomingVisible } = this.state;
  62. const { VIDEO_QUALITY_LABEL_DISABLED } = interfaceConfig;
  63. const className = `large-video-labels ${
  64. filmstripBecomingVisible ? 'opening' : ''} ${
  65. _filmstripVisible ? 'with-filmstrip' : 'without-filmstrip'}`;
  66. return (
  67. <div className = { className } >
  68. {
  69. this._renderE2EELabel()
  70. }
  71. {
  72. this._renderRecordingLabel(
  73. JitsiRecordingConstants.mode.FILE)
  74. }
  75. {
  76. this._renderRecordingLabel(
  77. JitsiRecordingConstants.mode.STREAM)
  78. }
  79. {
  80. this._renderLocalRecordingLabel()
  81. }
  82. {
  83. this._renderTranscribingLabel()
  84. }
  85. {
  86. this.props._showVideoQualityLabel && !VIDEO_QUALITY_LABEL_DISABLED
  87. && this._renderVideoQualityLabel()
  88. }
  89. {
  90. this._renderInsecureRoomNameLabel()
  91. }
  92. </div>
  93. );
  94. }
  95. _renderE2EELabel: () => React$Element<*>;
  96. _renderLocalRecordingLabel: () => React$Element<*>;
  97. _renderRecordingLabel: string => React$Element<*>;
  98. _renderTranscribingLabel: () => React$Element<*>;
  99. _renderInsecureRoomNameLabel: () => React$Element<any>;
  100. _renderVideoQualityLabel: () => React$Element<*>;
  101. }
  102. export default connect(_mapStateToProps)(Labels);