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.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. /**
  10. * The type of the React {@code Component} state of {@link Labels}.
  11. */
  12. type State = {
  13. /**
  14. * Whether or not the filmstrip was not visible but has transitioned in the
  15. * latest component update to visible. This boolean is used to set a class
  16. * for position animations.
  17. *
  18. * @type {boolean}
  19. */
  20. filmstripBecomingVisible: boolean
  21. };
  22. /**
  23. * A container to hold video status labels, including recording status and
  24. * current large video quality.
  25. *
  26. * @extends Component
  27. */
  28. class Labels extends AbstractLabels<Props, State> {
  29. /**
  30. * Updates the state for whether or not the filmstrip is transitioning to
  31. * a displayed state.
  32. *
  33. * @inheritdoc
  34. */
  35. static getDerivedStateFromProps(props: Props, prevState: State) {
  36. return {
  37. filmstripBecomingVisible: !prevState.filmstripBecomingVisible
  38. && 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 className = `large-video-labels ${
  63. filmstripBecomingVisible ? 'opening' : ''} ${
  64. _filmstripVisible ? 'with-filmstrip' : 'without-filmstrip'}`;
  65. return (
  66. <div className = { className } >
  67. {
  68. this._renderE2EELabel()
  69. }
  70. {
  71. this._renderRecordingLabel(
  72. JitsiRecordingConstants.mode.FILE)
  73. }
  74. {
  75. this._renderRecordingLabel(
  76. JitsiRecordingConstants.mode.STREAM)
  77. }
  78. {
  79. this._renderLocalRecordingLabel()
  80. }
  81. {
  82. this._renderTranscribingLabel()
  83. }
  84. {
  85. this.props._showVideoQualityLabel
  86. && this._renderVideoQualityLabel()
  87. }
  88. </div>
  89. );
  90. }
  91. _renderE2EELabel: () => React$Element<*>;
  92. _renderLocalRecordingLabel: () => React$Element<*>;
  93. _renderRecordingLabel: string => React$Element<*>;
  94. _renderTranscribingLabel: () => React$Element<*>;
  95. _renderVideoQualityLabel: () => React$Element<*>;
  96. }
  97. export default connect(_mapStateToProps)(Labels);