|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+import PropTypes from 'prop-types';
|
|
|
2
|
+import React, { Component } from 'react';
|
|
|
3
|
+import { connect } from 'react-redux';
|
|
|
4
|
+
|
|
|
5
|
+import { Dialog } from '../../base/dialog';
|
|
|
6
|
+import { translate } from '../../base/i18n';
|
|
|
7
|
+
|
|
|
8
|
+import { sendAnalyticsEvent } from '../../analytics';
|
|
|
9
|
+import { muteRemoteParticipant } from '../../base/participants';
|
|
|
10
|
+
|
|
|
11
|
+/**
|
|
|
12
|
+ * A React Component with the contents for a dialog that asks for confirmation
|
|
|
13
|
+ * from the user before muting a remote participant.
|
|
|
14
|
+ *
|
|
|
15
|
+ * @extends Component
|
|
|
16
|
+ */
|
|
|
17
|
+class MuteRemoteParticipantDialog extends Component {
|
|
|
18
|
+ /**
|
|
|
19
|
+ * {@code MuteRemoteParticipantDialog} component's property types.
|
|
|
20
|
+ *
|
|
|
21
|
+ * @static
|
|
|
22
|
+ */
|
|
|
23
|
+ static propTypes = {
|
|
|
24
|
+ /**
|
|
|
25
|
+ * Invoked to send a request for muting the participant with the passed
|
|
|
26
|
+ * in participantID.
|
|
|
27
|
+ */
|
|
|
28
|
+ dispatch: PropTypes.func,
|
|
|
29
|
+
|
|
|
30
|
+ /**
|
|
|
31
|
+ * The ID of the participant linked to the onClick callback.
|
|
|
32
|
+ */
|
|
|
33
|
+ participantID: PropTypes.string,
|
|
|
34
|
+
|
|
|
35
|
+ /**
|
|
|
36
|
+ * Invoked to obtain translated strings.
|
|
|
37
|
+ */
|
|
|
38
|
+ t: PropTypes.func
|
|
|
39
|
+ };
|
|
|
40
|
+
|
|
|
41
|
+ /**
|
|
|
42
|
+ * Initializes a new {@code MuteRemoteParticipantDialog} instance.
|
|
|
43
|
+ *
|
|
|
44
|
+ * @param {Object} props - The read-only properties with which the new
|
|
|
45
|
+ * instance is to be initialized.
|
|
|
46
|
+ */
|
|
|
47
|
+ constructor(props) {
|
|
|
48
|
+ super(props);
|
|
|
49
|
+
|
|
|
50
|
+ // Bind event handlers so they are only bound once per instance.
|
|
|
51
|
+ this._onSubmit = this._onSubmit.bind(this);
|
|
|
52
|
+ this._renderContent = this._renderContent.bind(this);
|
|
|
53
|
+ }
|
|
|
54
|
+
|
|
|
55
|
+ /**
|
|
|
56
|
+ * Implements React's {@link Component#render()}.
|
|
|
57
|
+ *
|
|
|
58
|
+ * @inheritdoc
|
|
|
59
|
+ * @returns {ReactElement}
|
|
|
60
|
+ */
|
|
|
61
|
+ render() {
|
|
|
62
|
+ return (
|
|
|
63
|
+ <Dialog
|
|
|
64
|
+ okTitleKey = 'dialog.muteParticipantButton'
|
|
|
65
|
+ onSubmit = { this._onSubmit }
|
|
|
66
|
+ titleKey = 'dialog.muteParticipantTitle'
|
|
|
67
|
+ width = 'small'>
|
|
|
68
|
+ { this._renderContent() }
|
|
|
69
|
+ </Dialog>
|
|
|
70
|
+ );
|
|
|
71
|
+ }
|
|
|
72
|
+
|
|
|
73
|
+ /**
|
|
|
74
|
+ * Handles the submit button action.
|
|
|
75
|
+ *
|
|
|
76
|
+ * @private
|
|
|
77
|
+ * @returns {void}
|
|
|
78
|
+ */
|
|
|
79
|
+ _onSubmit() {
|
|
|
80
|
+ const { dispatch, participantID } = this.props;
|
|
|
81
|
+
|
|
|
82
|
+ sendAnalyticsEvent(
|
|
|
83
|
+ 'remotevideomenu.mute.confirmed',
|
|
|
84
|
+ {
|
|
|
85
|
+ value: 1,
|
|
|
86
|
+ label: participantID
|
|
|
87
|
+ }
|
|
|
88
|
+ );
|
|
|
89
|
+
|
|
|
90
|
+ dispatch(muteRemoteParticipant(participantID));
|
|
|
91
|
+
|
|
|
92
|
+ return true;
|
|
|
93
|
+ }
|
|
|
94
|
+
|
|
|
95
|
+ /**
|
|
|
96
|
+ * Renders the content of the dialog.
|
|
|
97
|
+ *
|
|
|
98
|
+ * @returns {Component} the react component, which is the view of the dialog
|
|
|
99
|
+ * content
|
|
|
100
|
+ * @private
|
|
|
101
|
+ */
|
|
|
102
|
+ _renderContent() {
|
|
|
103
|
+ const { t } = this.props;
|
|
|
104
|
+
|
|
|
105
|
+ return (
|
|
|
106
|
+ <div>
|
|
|
107
|
+ { t('dialog.muteParticipantBody') }
|
|
|
108
|
+ </div>
|
|
|
109
|
+ );
|
|
|
110
|
+ }
|
|
|
111
|
+
|
|
|
112
|
+}
|
|
|
113
|
+
|
|
|
114
|
+export default translate(connect()(MuteRemoteParticipantDialog));
|