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.web.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. * Initializes a new {@code Labels} instance.
  31. *
  32. * @param {Object} props - The read-only properties with which the new
  33. * instance is to be initialized.
  34. */
  35. constructor(props: Props) {
  36. super(props);
  37. this.state = {
  38. filmstripBecomingVisible: false
  39. };
  40. }
  41. /**
  42. * Updates the state for whether or not the filmstrip is being toggled to
  43. * display after having being hidden.
  44. *
  45. * @inheritdoc
  46. * @param {Object} nextProps - The read-only props which this Component will
  47. * receive.
  48. * @returns {void}
  49. */
  50. componentWillReceiveProps(nextProps) {
  51. this.setState({
  52. filmstripBecomingVisible: nextProps._filmstripVisible
  53. && !this.props._filmstripVisible
  54. });
  55. }
  56. /**
  57. * Implements React's {@link Component#render()}.
  58. *
  59. * @inheritdoc
  60. * @returns {ReactElement}
  61. */
  62. render() {
  63. const { _filmstripVisible } = this.props;
  64. const { filmstripBecomingVisible } = this.state;
  65. const className = `large-video-labels ${
  66. filmstripBecomingVisible ? 'opening' : ''} ${
  67. _filmstripVisible ? 'with-filmstrip' : 'without-filmstrip'}`;
  68. return (
  69. <div className = { className } >
  70. {
  71. this._renderRecordingLabel(
  72. JitsiRecordingConstants.mode.FILE)
  73. }
  74. {
  75. this._renderRecordingLabel(
  76. JitsiRecordingConstants.mode.STREAM)
  77. }
  78. {
  79. this._renderTranscribingLabel()
  80. }
  81. {
  82. this._renderVideoQualityLabel()
  83. }
  84. </div>
  85. );
  86. }
  87. _renderRecordingLabel: string => React$Element<*>
  88. _renderVideoQualityLabel: () => React$Element<*>
  89. _renderTranscribingLabel: () => React$Element<*>
  90. }
  91. export default connect(_mapStateToProps)(Labels);