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

ShareScreenWarningDialog.tsx 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import React, { Component } from 'react';
  2. import { WithTranslation } from 'react-i18next';
  3. import { IStore } from '../../app/types';
  4. import { translate } from '../../base/i18n/functions';
  5. import { connect } from '../../base/redux/functions';
  6. import { toggleScreensharing } from '../../base/tracks/actions';
  7. import Dialog from '../../base/ui/components/web/Dialog';
  8. export interface Props extends WithTranslation {
  9. /**
  10. * Whether or not the dialog was opened for the audio screen sharing flow or the normal one.
  11. */
  12. _isAudioScreenShareWarning: Boolean;
  13. /**
  14. * The redux {@code dispatch} function.
  15. */
  16. dispatch: IStore['dispatch'];
  17. }
  18. /**
  19. * Component that displays the share audio helper dialog.
  20. */
  21. class ShareScreenWarningDialog extends Component<Props> {
  22. /**
  23. * Instantiates a new component.
  24. *
  25. * @inheritdoc
  26. */
  27. constructor(props: Props) {
  28. super(props);
  29. this._onStopSharing = this._onStopSharing.bind(this);
  30. }
  31. /**
  32. * Stop current screen sharing session.
  33. *
  34. * @returns {boolean}
  35. */
  36. _onStopSharing() {
  37. // Depending on the context from which this dialog is opened we'll either be toggling off an audio only
  38. // share session or a normal screen sharing one, this is indicated by the _isAudioScreenShareWarning prop.
  39. this.props.dispatch(toggleScreensharing(undefined,
  40. !this.props._isAudioScreenShareWarning));
  41. return true;
  42. }
  43. /**
  44. * Implements {@Component#render}.
  45. *§.
  46. *
  47. * @inheritdoc
  48. */
  49. render() {
  50. const { t } = this.props;
  51. let description1, description2, header1, header2, stopSharing, title;
  52. if (this.props._isAudioScreenShareWarning) {
  53. header1 = 'dialog.shareAudioWarningH1';
  54. header2 = 'dialog.shareMediaWarningGenericH2';
  55. description1 = 'dialog.shareAudioWarningD1';
  56. description2 = 'dialog.shareAudioWarningD2';
  57. title = 'dialog.shareAudioWarningTitle';
  58. stopSharing = 'toolbar.stopScreenSharing';
  59. } else {
  60. header1 = 'dialog.shareScreenWarningTitle';
  61. header2 = 'dialog.shareMediaWarningGenericH2';
  62. description1 = 'dialog.shareScreenWarningD1';
  63. description2 = 'dialog.shareScreenWarningD2';
  64. title = 'dialog.shareScreenWarningTitle';
  65. stopSharing = 'toolbar.stopAudioSharing';
  66. }
  67. return (<Dialog
  68. ok = {{ translationKey: stopSharing }}
  69. onSubmit = { this._onStopSharing }
  70. titleKey = { t(title) }>
  71. <div className = 'share-screen-warn-dialog'>
  72. <p className = 'header'> { t(header1) } </p>
  73. <p className = 'description' > { t(description1) } </p>
  74. <div className = 'separator-line' />
  75. <p className = 'header' > { t(header2) } </p>
  76. <p className = 'description' > { t(description2) } </p>
  77. </div>
  78. </Dialog>);
  79. }
  80. }
  81. export default translate(connect()(ShareScreenWarningDialog));