Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

AbstractLabels.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { isFilmstripVisible } from '../../filmstrip';
  4. import { LocalRecordingLabel } from '../../local-recording';
  5. import { RecordingLabel } from '../../recording';
  6. import { TranscribingLabel } from '../../transcribing';
  7. import { shouldDisplayTileView } from '../../video-layout';
  8. import { VideoQualityLabel } from '../../video-quality';
  9. /**
  10. * The type of the React {@code Component} props of {@link AbstractLabels}.
  11. */
  12. export type Props = {
  13. /**
  14. * Whether the filmstrip is displayed with remote videos. Used to determine
  15. * display classes to set.
  16. */
  17. _filmstripVisible: boolean,
  18. /**
  19. * Whether the video quality label should be displayed.
  20. */
  21. _showTranscribingLabel: boolean,
  22. /**
  23. * Whether the video quality label should be displayed.
  24. */
  25. _showVideoQualityLabel: boolean
  26. };
  27. /**
  28. * A container to hold video status labels, including recording status and
  29. * current large video quality.
  30. *
  31. * @extends Component
  32. */
  33. export default class AbstractLabels<P: Props, S> extends Component<P, S> {
  34. /**
  35. * Renders the {@code LocalRecordingLabel}.
  36. *
  37. * @protected
  38. * @returns {React$Element}
  39. */
  40. _renderLocalRecordingLabel() {
  41. return (
  42. <LocalRecordingLabel />
  43. );
  44. }
  45. /**
  46. * Renders the {@code RecordingLabel} that is platform independent.
  47. *
  48. * @param {string} mode - The recording mode that this label is rendered
  49. * for.
  50. * @protected
  51. * @returns {React$Element}
  52. */
  53. _renderRecordingLabel(mode: string) {
  54. return (
  55. <RecordingLabel mode = { mode } />
  56. );
  57. }
  58. /**
  59. * Renders the {@code TranscribingLabel}.
  60. *
  61. * @protected
  62. * @returns {React$Element}
  63. */
  64. _renderTranscribingLabel() {
  65. if (this.props._showTranscribingLabel) {
  66. return (
  67. <TranscribingLabel />
  68. );
  69. }
  70. return null;
  71. }
  72. /**
  73. * Renders the {@code VideoQualityLabel} that is platform independent.
  74. *
  75. * @protected
  76. * @returns {React$Element}
  77. */
  78. _renderVideoQualityLabel() {
  79. return (
  80. <VideoQualityLabel />
  81. );
  82. }
  83. }
  84. /**
  85. * Maps (parts of) the redux state to the associated props of the {@link Labels}
  86. * {@code Component}.
  87. *
  88. * @param {Object} state - The redux state.
  89. * @private
  90. * @returns {{
  91. * _filmstripVisible: boolean,
  92. * _showTranscribingLabel: boolean,
  93. * _showVideoQualityLabel: boolean
  94. * }}
  95. */
  96. export function _abstractMapStateToProps(state: Object) {
  97. return {
  98. _filmstripVisible: isFilmstripVisible(state),
  99. _showTranscribingLabel: state['features/transcribing'].isTranscribing,
  100. _showVideoQualityLabel: !shouldDisplayTileView(state)
  101. };
  102. }