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

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