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

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