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.

PreMeetingScreen.js 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. // @flow
  2. import React, { PureComponent } from 'react';
  3. import { connect } from '../../../../base/redux';
  4. import DeviceStatus from '../../../../prejoin/components/preview/DeviceStatus';
  5. import { Toolbox } from '../../../../toolbox/components/web';
  6. import { PREMEETING_BUTTONS, THIRD_PARTY_PREJOIN_BUTTONS } from '../../../config/constants';
  7. import ConnectionStatus from './ConnectionStatus';
  8. import Preview from './Preview';
  9. type Props = {
  10. /**
  11. * The list of toolbar buttons to render.
  12. */
  13. _buttons: Array<string>,
  14. /**
  15. * The branding background of the premeeting screen(lobby/prejoin).
  16. */
  17. _premeetingBackground: string,
  18. /**
  19. * Children component(s) to be rendered on the screen.
  20. */
  21. children?: React$Node,
  22. /**
  23. * Additional CSS class names to set on the icon container.
  24. */
  25. className?: string,
  26. /**
  27. * The name of the participant.
  28. */
  29. name?: string,
  30. /**
  31. * Indicates whether the copy url button should be shown
  32. */
  33. showCopyUrlButton: boolean,
  34. /**
  35. * Indicates whether the device status should be shown
  36. */
  37. showDeviceStatus: boolean,
  38. /**
  39. * The 'Skip prejoin' button to be rendered (if any).
  40. */
  41. skipPrejoinButton?: React$Node,
  42. /**
  43. * Title of the screen.
  44. */
  45. title?: string,
  46. /**
  47. * Whether it's used in the 3rdParty prejoin screen or not.
  48. */
  49. thirdParty?: boolean,
  50. /**
  51. * True if the preview overlay should be muted, false otherwise.
  52. */
  53. videoMuted?: boolean,
  54. /**
  55. * The video track to render as preview (if omitted, the default local track will be rendered).
  56. */
  57. videoTrack?: Object
  58. }
  59. /**
  60. * Implements a pre-meeting screen that can be used at various pre-meeting phases, for example
  61. * on the prejoin screen (pre-connection) or lobby (post-connection).
  62. */
  63. class PreMeetingScreen extends PureComponent<Props> {
  64. /**
  65. * Default values for {@code Prejoin} component's properties.
  66. *
  67. * @static
  68. */
  69. static defaultProps = {
  70. showCopyUrlButton: true,
  71. showToolbox: true
  72. };
  73. /**
  74. * Implements {@code PureComponent#render}.
  75. *
  76. * @inheritdoc
  77. */
  78. render() {
  79. const {
  80. _buttons,
  81. _premeetingBackground,
  82. children,
  83. className,
  84. showDeviceStatus,
  85. skipPrejoinButton,
  86. title,
  87. videoMuted,
  88. videoTrack
  89. } = this.props;
  90. const containerClassName = `premeeting-screen ${className ? className : ''}`;
  91. const style = _premeetingBackground ? {
  92. background: _premeetingBackground,
  93. backgroundPosition: 'center',
  94. backgroundSize: 'cover'
  95. } : {};
  96. return (
  97. <div className = { containerClassName }>
  98. <div style = { style }>
  99. <div className = 'content'>
  100. <ConnectionStatus />
  101. <div className = 'content-controls'>
  102. <h1 className = 'title'>
  103. { title }
  104. </h1>
  105. { children }
  106. { _buttons.length && <Toolbox toolbarButtons = { _buttons } /> }
  107. { skipPrejoinButton }
  108. { showDeviceStatus && <DeviceStatus /> }
  109. </div>
  110. </div>
  111. </div>
  112. <Preview
  113. videoMuted = { videoMuted }
  114. videoTrack = { videoTrack } />
  115. </div>
  116. );
  117. }
  118. }
  119. /**
  120. * Maps (parts of) the redux state to the React {@code Component} props.
  121. *
  122. * @param {Object} state - The redux state.
  123. * @param {Object} ownProps - The props passed to the component.
  124. * @returns {Object}
  125. */
  126. function mapStateToProps(state, ownProps): Object {
  127. const hideButtons = state['features/base/config'].hiddenPremeetingButtons || [];
  128. const premeetingButtons = ownProps.thirdParty
  129. ? THIRD_PARTY_PREJOIN_BUTTONS
  130. : PREMEETING_BUTTONS;
  131. const { premeetingBackground } = state['features/dynamic-branding'];
  132. return {
  133. _buttons: premeetingButtons.filter(b => !hideButtons.includes(b)),
  134. _premeetingBackground: premeetingBackground
  135. };
  136. }
  137. export default connect(mapStateToProps)(PreMeetingScreen);