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.

ConferenceInfo.js 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. // @flow
  2. /* eslint-disable react/no-multi-comp */
  3. import React, { Component } from 'react';
  4. import { JitsiRecordingConstants } from '../../../base/lib-jitsi-meet';
  5. import { connect } from '../../../base/redux';
  6. import E2EELabel from '../../../e2ee/components/E2EELabel';
  7. import HighlightButton from '../../../recording/components/Recording/web/HighlightButton';
  8. import RecordingLabel from '../../../recording/components/web/RecordingLabel';
  9. import { isToolboxVisible } from '../../../toolbox/functions.web';
  10. import TranscribingLabel from '../../../transcribing/components/TranscribingLabel.web';
  11. import VideoQualityLabel from '../../../video-quality/components/VideoQualityLabel.web';
  12. import ConferenceTimer from '../ConferenceTimer';
  13. import { getConferenceInfo } from '../functions';
  14. import ConferenceInfoContainer from './ConferenceInfoContainer';
  15. import InsecureRoomNameLabel from './InsecureRoomNameLabel';
  16. import RaisedHandsCountLabel from './RaisedHandsCountLabel';
  17. import SpeakerStatsLabel from './SpeakerStatsLabel';
  18. import SubjectText from './SubjectText';
  19. import ToggleTopPanelLabel from './ToggleTopPanelLabel';
  20. /**
  21. * The type of the React {@code Component} props of {@link Subject}.
  22. */
  23. type Props = {
  24. /**
  25. * The conference info labels to be shown in the conference header.
  26. */
  27. _conferenceInfo: Object,
  28. /**
  29. * Indicates whether the component should be visible or not.
  30. */
  31. _visible: boolean
  32. };
  33. const COMPONENTS = [
  34. {
  35. Component: HighlightButton,
  36. id: 'highlight-moment'
  37. },
  38. {
  39. Component: SubjectText,
  40. id: 'subject'
  41. },
  42. {
  43. Component: ConferenceTimer,
  44. id: 'conference-timer'
  45. },
  46. {
  47. Component: SpeakerStatsLabel,
  48. id: 'participants-count'
  49. },
  50. {
  51. Component: E2EELabel,
  52. id: 'e2ee'
  53. },
  54. {
  55. Component: () => (
  56. <>
  57. <RecordingLabel mode = { JitsiRecordingConstants.mode.FILE } />
  58. <RecordingLabel mode = { JitsiRecordingConstants.mode.STREAM } />
  59. </>
  60. ),
  61. id: 'recording'
  62. },
  63. {
  64. Component: RaisedHandsCountLabel,
  65. id: 'raised-hands-count'
  66. },
  67. {
  68. Component: TranscribingLabel,
  69. id: 'transcribing'
  70. },
  71. {
  72. Component: VideoQualityLabel,
  73. id: 'video-quality'
  74. },
  75. {
  76. Component: InsecureRoomNameLabel,
  77. id: 'insecure-room'
  78. },
  79. {
  80. Component: ToggleTopPanelLabel,
  81. id: 'top-panel-toggle'
  82. }
  83. ];
  84. /**
  85. * The upper band of the meeing containing the conference name, timer and labels.
  86. *
  87. * @param {Object} props - The props of the component.
  88. * @returns {React$None}
  89. */
  90. class ConferenceInfo extends Component<Props> {
  91. /**
  92. * Initializes a new {@code ConferenceInfo} instance.
  93. *
  94. * @param {Props} props - The read-only React {@code Component} props with
  95. * which the new instance is to be initialized.
  96. */
  97. constructor(props: Props) {
  98. super(props);
  99. this._renderAutoHide = this._renderAutoHide.bind(this);
  100. this._renderAlwaysVisible = this._renderAlwaysVisible.bind(this);
  101. }
  102. _renderAutoHide: () => void;
  103. /**
  104. * Renders auto-hidden info header labels.
  105. *
  106. * @returns {void}
  107. */
  108. _renderAutoHide() {
  109. const { autoHide } = this.props._conferenceInfo;
  110. if (!autoHide || !autoHide.length) {
  111. return null;
  112. }
  113. return (
  114. <ConferenceInfoContainer
  115. id = 'autoHide'
  116. visible = { this.props._visible }>
  117. {
  118. COMPONENTS
  119. .filter(comp => autoHide.includes(comp.id))
  120. .map(c =>
  121. <c.Component key = { c.id } />
  122. )
  123. }
  124. </ConferenceInfoContainer>
  125. );
  126. }
  127. _renderAlwaysVisible: () => void;
  128. /**
  129. * Renders the always visible info header labels.
  130. *
  131. * @returns {void}
  132. */
  133. _renderAlwaysVisible() {
  134. const { alwaysVisible } = this.props._conferenceInfo;
  135. if (!alwaysVisible || !alwaysVisible.length) {
  136. return null;
  137. }
  138. return (
  139. <ConferenceInfoContainer
  140. id = 'alwaysVisible'
  141. visible = { true } >
  142. {
  143. COMPONENTS
  144. .filter(comp => alwaysVisible.includes(comp.id))
  145. .map(c =>
  146. <c.Component key = { c.id } />
  147. )
  148. }
  149. </ConferenceInfoContainer>
  150. );
  151. }
  152. /**
  153. * Implements React's {@link Component#render()}.
  154. *
  155. * @inheritdoc
  156. * @returns {ReactElement}
  157. */
  158. render() {
  159. return (
  160. <div className = 'details-container' >
  161. { this._renderAlwaysVisible() }
  162. { this._renderAutoHide() }
  163. </div>
  164. );
  165. }
  166. }
  167. /**
  168. * Maps (parts of) the Redux state to the associated
  169. * {@code Subject}'s props.
  170. *
  171. * @param {Object} state - The Redux state.
  172. * @private
  173. * @returns {{
  174. * _visible: boolean,
  175. * _conferenceInfo: Object
  176. * }}
  177. */
  178. function _mapStateToProps(state) {
  179. return {
  180. _visible: isToolboxVisible(state),
  181. _conferenceInfo: getConferenceInfo(state)
  182. };
  183. }
  184. export default connect(_mapStateToProps)(ConferenceInfo);