Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

WaitForOwnerDialog.native.js 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. // @flow
  2. import React, { Component } from 'react';
  3. import { connect } from 'react-redux';
  4. import { ConfirmDialog } from '../../base/dialog';
  5. import { translate } from '../../base/i18n';
  6. import { cancelWaitForOwner, _openLoginDialog } from '../actions';
  7. /**
  8. * The type of the React {@code Component} props of {@link WaitForOwnerDialog}.
  9. */
  10. type Props = {
  11. /**
  12. * The name of the conference room (without the domain part).
  13. */
  14. _room: string,
  15. /**
  16. * Redux store dispatch function.
  17. */
  18. dispatch: Dispatch<*>,
  19. /**
  20. * Invoked to obtain translated strings.
  21. */
  22. t: Function
  23. };
  24. /**
  25. * The dialog is display in XMPP password + guest access configuration, after
  26. * user connects from anonymous domain and the conference does not exist yet.
  27. *
  28. * See {@link LoginDialog} description for more details.
  29. */
  30. class WaitForOwnerDialog extends Component<Props> {
  31. /**
  32. * Initializes a new WaitForWonderDialog instance.
  33. *
  34. * @param {Object} props - The read-only properties with which the new
  35. * instance is to be initialized.
  36. */
  37. constructor(props) {
  38. super(props);
  39. // Bind event handlers so they are only bound once per instance.
  40. this._onCancel = this._onCancel.bind(this);
  41. this._onLogin = this._onLogin.bind(this);
  42. }
  43. /**
  44. * Implements React's {@link Component#render()}.
  45. *
  46. * @inheritdoc
  47. * @returns {ReactElement}
  48. */
  49. render() {
  50. const {
  51. _room: room
  52. } = this.props;
  53. return (
  54. <ConfirmDialog
  55. contentKey = {
  56. {
  57. key: 'dialog.WaitForHostMsgWOk',
  58. params: { room }
  59. }
  60. }
  61. onCancel = { this._onCancel }
  62. onSubmit = { this._onLogin } />
  63. );
  64. }
  65. _onCancel: () => void;
  66. /**
  67. * Called when the cancel button is clicked.
  68. *
  69. * @private
  70. * @returns {void}
  71. */
  72. _onCancel() {
  73. this.props.dispatch(cancelWaitForOwner());
  74. }
  75. _onLogin: () => void;
  76. /**
  77. * Called when the OK button is clicked.
  78. *
  79. * @private
  80. * @returns {void}
  81. */
  82. _onLogin() {
  83. this.props.dispatch(_openLoginDialog());
  84. }
  85. }
  86. /**
  87. * Maps (parts of) the Redux state to the associated props for the
  88. * {@code WaitForOwnerDialog} component.
  89. *
  90. * @param {Object} state - The Redux state.
  91. * @private
  92. * @returns {{
  93. * _room: string
  94. * }}
  95. */
  96. function _mapStateToProps(state) {
  97. const { authRequired } = state['features/base/conference'];
  98. return {
  99. _room: authRequired && authRequired.getName()
  100. };
  101. }
  102. export default translate(connect(_mapStateToProps)(WaitForOwnerDialog));