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

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