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 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // @flow
  2. import React from 'react';
  3. import { connect } from 'react-redux';
  4. import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
  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._renderRecordingLabel(
  69. JitsiRecordingConstants.mode.FILE)
  70. }
  71. {
  72. this._renderRecordingLabel(
  73. JitsiRecordingConstants.mode.STREAM)
  74. }
  75. {
  76. this._renderLocalRecordingLabel()
  77. }
  78. {
  79. this._renderTranscribingLabel()
  80. }
  81. {
  82. this.props._showVideoQualityLabel
  83. && this._renderVideoQualityLabel()
  84. }
  85. </div>
  86. );
  87. }
  88. _renderLocalRecordingLabel: () => React$Element<*>;
  89. _renderRecordingLabel: string => React$Element<*>;
  90. _renderTranscribingLabel: () => React$Element<*>;
  91. _renderVideoQualityLabel: () => React$Element<*>;
  92. }
  93. // $FlowExpectedError
  94. export default connect(_mapStateToProps)(Labels);