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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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
  39. && props._filmstripVisible
  40. };
  41. }
  42. /**
  43. * Initializes a new {@code Labels} instance.
  44. *
  45. * @param {Object} props - The read-only properties with which the new
  46. * instance is to be initialized.
  47. */
  48. constructor(props: Props) {
  49. super(props);
  50. this.state = {
  51. filmstripBecomingVisible: false
  52. };
  53. }
  54. /**
  55. * Implements React's {@link Component#render()}.
  56. *
  57. * @inheritdoc
  58. * @returns {ReactElement}
  59. */
  60. render() {
  61. const { _filmstripVisible } = this.props;
  62. const { filmstripBecomingVisible } = this.state;
  63. const { VIDEO_QUALITY_LABEL_DISABLED } = interfaceConfig;
  64. const className = `large-video-labels ${
  65. filmstripBecomingVisible ? 'opening' : ''} ${
  66. _filmstripVisible ? 'with-filmstrip' : 'without-filmstrip'}`;
  67. return (
  68. <div className = { className } >
  69. {
  70. this._renderE2EELabel()
  71. }
  72. {
  73. this._renderRecordingLabel(
  74. JitsiRecordingConstants.mode.FILE)
  75. }
  76. {
  77. this._renderRecordingLabel(
  78. JitsiRecordingConstants.mode.STREAM)
  79. }
  80. {
  81. this._renderLocalRecordingLabel()
  82. }
  83. {
  84. this._renderTranscribingLabel()
  85. }
  86. {
  87. this.props._showVideoQualityLabel && !VIDEO_QUALITY_LABEL_DISABLED
  88. && this._renderVideoQualityLabel()
  89. }
  90. {
  91. this._renderInsecureRoomNameLabel()
  92. }
  93. </div>
  94. );
  95. }
  96. _renderE2EELabel: () => React$Element<*>;
  97. _renderLocalRecordingLabel: () => React$Element<*>;
  98. _renderRecordingLabel: string => React$Element<*>;
  99. _renderTranscribingLabel: () => React$Element<*>;
  100. _renderInsecureRoomNameLabel: () => React$Element<any>;
  101. _renderVideoQualityLabel: () => React$Element<*>;
  102. }
  103. export default connect(_mapStateToProps)(Labels);