選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

PageReloadOverlay.js 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // @flow
  2. import React from 'react';
  3. import { appNavigate, reloadNow } from '../../../app/actions';
  4. import { ConfirmDialog } from '../../../base/dialog';
  5. import { translate } from '../../../base/i18n';
  6. import { connect } from '../../../base/redux';
  7. import { setFatalError, setPageReloadOverlayCanceled } from '../../actions';
  8. import AbstractPageReloadOverlay, {
  9. type Props,
  10. abstractMapStateToProps
  11. } from '../AbstractPageReloadOverlay';
  12. import OverlayFrame from './OverlayFrame';
  13. /**
  14. * Implements a React Component for page reload overlay. Shown before the
  15. * conference is reloaded. Shows a warning message and counts down towards the
  16. * reload.
  17. */
  18. class PageReloadOverlay extends AbstractPageReloadOverlay<Props> {
  19. _interval: IntervalID;
  20. /**
  21. * Initializes a new PageReloadOverlay instance.
  22. *
  23. * @param {Object} props - The read-only properties with which the new
  24. * instance is to be initialized.
  25. * @public
  26. */
  27. constructor(props) {
  28. super(props);
  29. this._onCancel = this._onCancel.bind(this);
  30. this._onReloadNow = this._onReloadNow.bind(this);
  31. }
  32. _onCancel: () => void;
  33. /**
  34. * Handle clicking of the "Cancel" button. It will navigate back to the
  35. * welcome page.
  36. *
  37. * @private
  38. * @returns {void}
  39. */
  40. _onCancel() {
  41. clearInterval(this._interval);
  42. this.props.dispatch(setPageReloadOverlayCanceled(this.props.error));
  43. this.props.dispatch(setFatalError(undefined));
  44. this.props.dispatch(appNavigate(undefined));
  45. }
  46. _onReloadNow: () => void;
  47. /**
  48. * Handle clicking on the "Reload Now" button. It will navigate to the same
  49. * conference URL as before immediately, without waiting for the timer to
  50. * kick in.
  51. *
  52. * @private
  53. * @returns {void}
  54. */
  55. _onReloadNow() {
  56. clearInterval(this._interval);
  57. this.props.dispatch(reloadNow());
  58. }
  59. /**
  60. * Implements React's {@link Component#render()}.
  61. *
  62. * @inheritdoc
  63. * @returns {ReactElement}
  64. */
  65. render() {
  66. const { t } = this.props;
  67. const { message, timeLeft, title } = this.state;
  68. return (
  69. <OverlayFrame>
  70. <ConfirmDialog
  71. cancelLabel = 'dialog.Cancel'
  72. confirmLabel = 'dialog.rejoinNow'
  73. descriptionKey = { `${t(message, { seconds: timeLeft })}` }
  74. onCancel = { this._onCancel }
  75. onSubmit = { this._onReloadNow }
  76. title = { title } />
  77. </OverlayFrame>
  78. );
  79. }
  80. }
  81. export default translate(connect(abstractMapStateToProps)(PageReloadOverlay));