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.

Prejoin.js 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. // @flow
  2. import React, { Component } from 'react';
  3. import {
  4. joinConference as joinConferenceAction,
  5. joinConferenceWithoutAudio as joinConferenceWithoutAudioAction,
  6. setJoinByPhoneDialogVisiblity as setJoinByPhoneDialogVisiblityAction,
  7. setPrejoinName
  8. } from '../actions';
  9. import { getRoomName } from '../../base/conference';
  10. import { translate } from '../../base/i18n';
  11. import { connect } from '../../base/redux';
  12. import ActionButton from './buttons/ActionButton';
  13. import {
  14. areJoinByPhoneButtonsVisible,
  15. getPrejoinName,
  16. isDeviceStatusVisible,
  17. isJoinByPhoneDialogVisible
  18. } from '../functions';
  19. import { isGuest } from '../../invite';
  20. import CopyMeetingUrl from './preview/CopyMeetingUrl';
  21. import DeviceStatus from './preview/DeviceStatus';
  22. import ParticipantName from './preview/ParticipantName';
  23. import Preview from './preview/Preview';
  24. import { VideoSettingsButton, AudioSettingsButton } from '../../toolbox';
  25. type Props = {
  26. /**
  27. * Flag signaling if the device status is visible or not.
  28. */
  29. deviceStatusVisible: boolean,
  30. /**
  31. * Flag signaling if a user is logged in or not.
  32. */
  33. isAnonymousUser: boolean,
  34. /**
  35. * Joins the current meeting.
  36. */
  37. joinConference: Function,
  38. /**
  39. * Joins the current meeting without audio.
  40. */
  41. joinConferenceWithoutAudio: Function,
  42. /**
  43. * The name of the user that is about to join.
  44. */
  45. name: string,
  46. /**
  47. * Sets the name for the joining user.
  48. */
  49. setName: Function,
  50. /**
  51. * The name of the meeting that is about to be joined.
  52. */
  53. roomName: string,
  54. /**
  55. * Sets visibilit of the 'JoinByPhoneDialog'.
  56. */
  57. setJoinByPhoneDialogVisiblity: Function,
  58. /**
  59. * If 'JoinByPhoneDialog' is visible or not.
  60. */
  61. showDialog: boolean,
  62. /**
  63. * If join by phone buttons should be visible.
  64. */
  65. showJoinByPhoneButtons: boolean,
  66. /**
  67. * Used for translation.
  68. */
  69. t: Function,
  70. };
  71. /**
  72. * This component is displayed before joining a meeting.
  73. */
  74. class Prejoin extends Component<Props> {
  75. /**
  76. * Initializes a new {@code Prejoin} instance.
  77. *
  78. * @inheritdoc
  79. */
  80. constructor(props) {
  81. super(props);
  82. this._showDialog = this._showDialog.bind(this);
  83. }
  84. _showDialog: () => void;
  85. /**
  86. * Displays the dialog for joining a meeting by phone.
  87. *
  88. * @returns {undefined}
  89. */
  90. _showDialog() {
  91. this.props.setJoinByPhoneDialogVisiblity(true);
  92. }
  93. /**
  94. * Implements React's {@link Component#render()}.
  95. *
  96. * @inheritdoc
  97. * @returns {ReactElement}
  98. */
  99. render() {
  100. const {
  101. deviceStatusVisible,
  102. isAnonymousUser,
  103. joinConference,
  104. joinConferenceWithoutAudio,
  105. name,
  106. setName,
  107. showJoinByPhoneButtons,
  108. t
  109. } = this.props;
  110. const { _showDialog } = this;
  111. return (
  112. <div className = 'prejoin-full-page'>
  113. <Preview />
  114. <div className = 'prejoin-input-area-container'>
  115. <div className = 'prejoin-input-area'>
  116. <div className = 'prejoin-title'>
  117. {t('prejoin.joinMeeting')}
  118. </div>
  119. <CopyMeetingUrl />
  120. <ParticipantName
  121. isEditable = { isAnonymousUser }
  122. setName = { setName }
  123. value = { name } />
  124. <ActionButton
  125. onClick = { joinConference }
  126. type = 'primary'>
  127. { t('calendarSync.join') }
  128. </ActionButton>
  129. {showJoinByPhoneButtons
  130. && <div className = 'prejoin-text-btns'>
  131. <ActionButton
  132. onClick = { joinConferenceWithoutAudio }
  133. type = 'text'>
  134. { t('prejoin.joinWithoutAudio') }
  135. </ActionButton>
  136. <ActionButton
  137. onClick = { _showDialog }
  138. type = 'text'>
  139. { t('prejoin.joinAudioByPhone') }
  140. </ActionButton>
  141. </div>}
  142. </div>
  143. </div>
  144. <div className = 'prejoin-preview-btn-container'>
  145. <AudioSettingsButton visible = { true } />
  146. <VideoSettingsButton visible = { true } />
  147. </div>
  148. { deviceStatusVisible && <DeviceStatus /> }
  149. </div>
  150. );
  151. }
  152. }
  153. /**
  154. * Maps (parts of) the redux state to the React {@code Component} props.
  155. *
  156. * @param {Object} state - The redux state.
  157. * @returns {Object}
  158. */
  159. function mapStateToProps(state): Object {
  160. return {
  161. isAnonymousUser: isGuest(state),
  162. deviceStatusVisible: isDeviceStatusVisible(state),
  163. name: getPrejoinName(state),
  164. roomName: getRoomName(state),
  165. showDialog: isJoinByPhoneDialogVisible(state),
  166. showJoinByPhoneButtons: areJoinByPhoneButtonsVisible(state)
  167. };
  168. }
  169. const mapDispatchToProps = {
  170. joinConferenceWithoutAudio: joinConferenceWithoutAudioAction,
  171. joinConference: joinConferenceAction,
  172. setJoinByPhoneDialogVisiblity: setJoinByPhoneDialogVisiblityAction,
  173. setName: setPrejoinName
  174. };
  175. export default connect(mapStateToProps, mapDispatchToProps)(translate(Prejoin));