浏览代码

Comply w/ coding style

j8
Lyubo Marinov 8 年前
父节点
当前提交
87b488a12b

+ 1
- 1
react/features/base/conference/middleware.js 查看文件

@@ -113,7 +113,7 @@ function _pinParticipant(store, next, action) {
113 113
         pin = !localParticipant || !localParticipant.pinned;
114 114
     }
115 115
     if (pin) {
116
-        const conference = state['features/base/conference'].conference;
116
+        const { conference } = state['features/base/conference'];
117 117
 
118 118
         try {
119 119
             conference.pinParticipant(id);

+ 7
- 7
react/features/conference/route.js 查看文件

@@ -23,10 +23,10 @@ RouteRegistry.register({
23 23
 });
24 24
 
25 25
 /**
26
- *  Initialization of the app.
26
+ * Initialization of the app.
27 27
  *
28
- *  @private
29
- *  @returns {void}
28
+ * @private
29
+ * @returns {void}
30 30
  */
31 31
 function _initConference() {
32 32
     _setTokenData();
@@ -79,7 +79,9 @@ function _obtainConfigAndInit() {
79 79
                 .catch(err => {
80 80
                     // Show obtain config error.
81 81
                     APP.UI.messageHandler.openReportDialog(
82
-                        null, 'dialog.connectError', err);
82
+                        null,
83
+                        'dialog.connectError',
84
+                        err);
83 85
                 });
84 86
         } else {
85 87
             chooseBOSHAddress(config, room);
@@ -112,9 +114,7 @@ function _setTokenData() {
112 114
     const { caller } = state['features/jwt'];
113 115
 
114 116
     if (caller) {
115
-        const email = caller.email;
116
-        const avatarUrl = caller.avatarUrl;
117
-        const name = caller.name;
117
+        const { avatarUrl, email, name } = caller;
118 118
 
119 119
         APP.settings.setEmail((email || '').trim(), true);
120 120
         APP.settings.setAvatarUrl((avatarUrl || '').trim());

+ 6
- 6
react/features/invite/components/DialInNumbersForm.js 查看文件

@@ -10,11 +10,9 @@ import { updateDialInNumbers } from '../actions';
10 10
 
11 11
 const logger = require('jitsi-meet-logger').getLogger(__filename);
12 12
 
13
-const EXPAND_ICON = <ExpandIcon label = 'expand' />;
14
-
15 13
 /**
16 14
  * React {@code Component} responsible for fetching and displaying telephone
17
- * numbers for dialing into the conference. Also supports copying a selected
15
+ * numbers for dialing into a conference. Also supports copying a selected
18 16
  * dial-in number to the clipboard.
19 17
  *
20 18
  * @extends Component
@@ -105,8 +103,10 @@ class DialInNumbersForm extends Component {
105 103
      * returns {void}
106 104
      */
107 105
     componentWillMount() {
108
-        if (this.props._dialIn.numbers) {
109
-            this._setDefaultNumber(this.props._dialIn.numbers);
106
+        const { numbers } = this.props._dialIn;
107
+
108
+        if (numbers) {
109
+            this._setDefaultNumber(numbers);
110 110
         } else {
111 111
             this.props.dispatch(updateDialInNumbers());
112 112
         }
@@ -209,7 +209,7 @@ class DialInNumbersForm extends Component {
209 209
                     type = 'text'
210 210
                     value = { triggerText || '' } />
211 211
                 <span className = 'dial-in-numbers-trigger-icon'>
212
-                    { EXPAND_ICON }
212
+                    <ExpandIcon label = 'expand' />
213 213
                 </span>
214 214
             </div>
215 215
         );

+ 2
- 5
react/features/invite/components/InviteDialog.js 查看文件

@@ -4,14 +4,11 @@ import { connect } from 'react-redux';
4 4
 import { Dialog } from '../../base/dialog';
5 5
 import { translate } from '../../base/i18n';
6 6
 import JitsiMeetJS from '../../base/lib-jitsi-meet';
7
-import {
8
-    getLocalParticipant,
9
-    PARTICIPANT_ROLE
10
-} from '../../base/participants';
7
+import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
11 8
 
9
+import DialInNumbersForm from './DialInNumbersForm';
12 10
 import PasswordContainer from './PasswordContainer';
13 11
 import ShareLinkForm from './ShareLinkForm';
14
-import DialInNumbersForm from './DialInNumbersForm';
15 12
 
16 13
 /**
17 14
  * A React {@code Component} for displaying other components responsible for

+ 1
- 3
react/features/invite/reducer.js 查看文件

@@ -1,6 +1,4 @@
1
-import {
2
-    ReducerRegistry
3
-} from '../base/redux';
1
+import { ReducerRegistry } from '../base/redux';
4 2
 
5 3
 import {
6 4
     UPDATE_DIAL_IN_NUMBERS_FAILED,

+ 2
- 2
react/features/overlay/actions.js 查看文件

@@ -9,12 +9,12 @@ import {
9 9
  * @param {boolean} isVisible - If the value is true - the prompt for media
10 10
  * permission is visible otherwise the value is false/undefined.
11 11
  * @param {string} browser - The name of the current browser.
12
+ * @public
12 13
  * @returns {{
13 14
  *     type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
14 15
  *     browser: {string},
15 16
  *     isVisible: {boolean}
16 17
  * }}
17
- * @public
18 18
  */
19 19
 export function mediaPermissionPromptVisibilityChanged(isVisible, browser) {
20 20
     return {
@@ -27,10 +27,10 @@ export function mediaPermissionPromptVisibilityChanged(isVisible, browser) {
27 27
 /**
28 28
  * Signals that suspend was detected.
29 29
  *
30
+ * @public
30 31
  * @returns {{
31 32
  *     type: SUSPEND_DETECTED
32 33
  * }}
33
- * @public
34 34
  */
35 35
 export function suspendDetected() {
36 36
     return {

+ 108
- 78
react/features/overlay/components/AbstractPageReloadOverlay.js 查看文件

@@ -1,3 +1,5 @@
1
+/* @flow */
2
+
1 3
 import React, { Component } from 'react';
2 4
 
3 5
 import { randomInt } from '../../base/util';
@@ -36,9 +38,51 @@ export default class AbstractPageReloadOverlay extends Component {
36 38
          * @public
37 39
          * @type {string}
38 40
          */
39
-        reason: React.PropTypes.string
41
+        reason: React.PropTypes.string,
42
+
43
+        /**
44
+         * The function to translate human-readable text.
45
+         *
46
+         * @public
47
+         * @type {Function}
48
+         */
49
+        t: React.PropTypes.func
40 50
     };
41 51
 
52
+    _interval: ?number
53
+
54
+    state: {
55
+
56
+        /**
57
+         * The translation key for the title of the overlay.
58
+         *
59
+         * @type {string}
60
+         */
61
+        message: string,
62
+
63
+        /**
64
+         * Current value(time) of the timer.
65
+         *
66
+         * @type {number}
67
+         */
68
+        timeLeft: number,
69
+
70
+        /**
71
+         * How long the overlay dialog will be displayed before the
72
+         * conference will be reloaded.
73
+         *
74
+         * @type {number}
75
+         */
76
+        timeoutSeconds: number,
77
+
78
+        /**
79
+         * The translation key for the title of the overlay.
80
+         *
81
+         * @type {string}
82
+         */
83
+        title: string
84
+    }
85
+
42 86
     /**
43 87
      * Initializes a new AbstractPageReloadOverlay instance.
44 88
      *
@@ -46,7 +90,7 @@ export default class AbstractPageReloadOverlay extends Component {
46 90
      * instance is to be initialized.
47 91
      * @public
48 92
      */
49
-    constructor(props) {
93
+    constructor(props: Object) {
50 94
         super(props);
51 95
 
52 96
         /**
@@ -68,75 +112,18 @@ export default class AbstractPageReloadOverlay extends Component {
68 112
         }
69 113
 
70 114
         this.state = {
71
-            /**
72
-             * The translation key for the title of the overlay.
73
-             *
74
-             * @type {string}
75
-             */
76 115
             message,
77
-
78
-            /**
79
-             * Current value(time) of the timer.
80
-             *
81
-             * @type {number}
82
-             */
83 116
             timeLeft: timeoutSeconds,
84
-
85
-            /**
86
-             * How long the overlay dialog will be displayed before the
87
-             * conference will be reloaded.
88
-             *
89
-             * @type {number}
90
-             */
91 117
             timeoutSeconds,
92
-
93
-            /**
94
-             * The translation key for the title of the overlay.
95
-             *
96
-             * @type {string}
97
-             */
98 118
             title
99 119
         };
100 120
     }
101 121
 
102
-    /**
103
-     * Renders the button for relaod the page if necessary.
104
-     *
105
-     * @returns {ReactElement|null}
106
-     * @private
107
-     */
108
-    _renderButton() {
109
-        if (this.props.isNetworkFailure) {
110
-            return (
111
-                <ReloadButton textKey = 'dialog.rejoinNow' />
112
-            );
113
-        }
114
-
115
-        return null;
116
-    }
117
-
118
-    /**
119
-     * Renders the progress bar.
120
-     *
121
-     * @returns {ReactElement|null}
122
-     * @protected
123
-     */
124
-    _renderProgressBar() {
125
-        return (
126
-            <div
127
-                className = 'aui-progress-indicator'
128
-                id = 'reloadProgressBar'>
129
-                <span className = 'aui-progress-indicator-value' />
130
-            </div>
131
-        );
132
-    }
133
-
134 122
     /**
135 123
      * React Component method that executes once component is mounted.
136 124
      *
137 125
      * @inheritdoc
138 126
      * @returns {void}
139
-     * @protected
140 127
      */
141 128
     componentDidMount() {
142 129
         // FIXME (CallStats - issue) This event will not make it to CallStats
@@ -148,23 +135,30 @@ export default class AbstractPageReloadOverlay extends Component {
148 135
                 /* value */ undefined,
149 136
                 /* label */ this.props.reason);
150 137
         logger.info(
151
-                'The conference will be reloaded after '
152
-                    + `${this.state.timeoutSeconds} seconds.`);
138
+                `The conference will be reloaded after ${
139
+                    this.state.timeoutSeconds} seconds.`);
153 140
 
154 141
         AJS.progressBars.update('#reloadProgressBar', 0);
155 142
 
156
-        this.intervalId = setInterval(() => {
157
-            if (this.state.timeLeft === 0) {
158
-                clearInterval(this.intervalId);
159
-                reconnectNow();
160
-            } else {
161
-                this.setState(prevState => {
162
-                    return {
163
-                        timeLeft: prevState.timeLeft - 1
164
-                    };
165
-                });
166
-            }
167
-        }, 1000);
143
+        this._interval
144
+            = setInterval(
145
+                    () => {
146
+                        if (this.state.timeLeft === 0) {
147
+                            if (this._interval) {
148
+                                clearInterval(this._interval);
149
+                                this._interval = undefined;
150
+                            }
151
+
152
+                            reconnectNow();
153
+                        } else {
154
+                            this.setState(prevState => {
155
+                                return {
156
+                                    timeLeft: prevState.timeLeft - 1
157
+                                };
158
+                            });
159
+                        }
160
+                    },
161
+                    1000);
168 162
     }
169 163
 
170 164
     /**
@@ -172,12 +166,13 @@ export default class AbstractPageReloadOverlay extends Component {
172 166
      *
173 167
      * @inheritdoc
174 168
      * @returns {void}
175
-     * @protected
176 169
      */
177 170
     componentDidUpdate() {
178
-        AJS.progressBars.update('#reloadProgressBar',
179
-            (this.state.timeoutSeconds - this.state.timeLeft)
180
-                / this.state.timeoutSeconds);
171
+        const { timeLeft, timeoutSeconds } = this.state;
172
+
173
+        AJS.progressBars.update(
174
+            '#reloadProgressBar',
175
+            (timeoutSeconds - timeLeft) / timeoutSeconds);
181 176
     }
182 177
 
183 178
     /**
@@ -187,6 +182,41 @@ export default class AbstractPageReloadOverlay extends Component {
187 182
      * @returns {void}
188 183
      */
189 184
     componentWillUnmount() {
190
-        clearInterval(this.intervalId);
185
+        if (this._interval) {
186
+            clearInterval(this._interval);
187
+            this._interval = undefined;
188
+        }
189
+    }
190
+
191
+    /**
192
+     * Renders the button for relaod the page if necessary.
193
+     *
194
+     * @protected
195
+     * @returns {ReactElement|null}
196
+     */
197
+    _renderButton() {
198
+        if (this.props.isNetworkFailure) {
199
+            return (
200
+                <ReloadButton textKey = 'dialog.rejoinNow' />
201
+            );
202
+        }
203
+
204
+        return null;
205
+    }
206
+
207
+    /**
208
+     * Renders the progress bar.
209
+     *
210
+     * @protected
211
+     * @returns {ReactElement}
212
+     */
213
+    _renderProgressBar() {
214
+        return (
215
+            <div
216
+                className = 'aui-progress-indicator'
217
+                id = 'reloadProgressBar'>
218
+                <span className = 'aui-progress-indicator-value' />
219
+            </div>
220
+        );
191 221
     }
192 222
 }

+ 2
- 23
react/features/overlay/components/PageReloadFilmstripOnlyOverlay.js 查看文件

@@ -11,23 +11,6 @@ import FilmstripOnlyOverlayFrame from './FilmstripOnlyOverlayFrame';
11 11
  * counts down towards the reload.
12 12
  */
13 13
 class PageReloadFilmstripOnlyOverlay extends AbstractPageReloadOverlay {
14
-    /**
15
-     * PageReloadFilmstripOnlyOverlay component's property types.
16
-     *
17
-     * @static
18
-     */
19
-    static propTypes = {
20
-        ...AbstractPageReloadOverlay.propTypes,
21
-
22
-        /**
23
-         * The function to translate human-readable text.
24
-         *
25
-         * @public
26
-         * @type {Function}
27
-         */
28
-        t: React.PropTypes.func
29
-    };
30
-
31 14
     /**
32 15
      * Implements React's {@link Component#render()}.
33 16
      *
@@ -48,12 +31,8 @@ class PageReloadFilmstripOnlyOverlay extends AbstractPageReloadOverlay {
48 31
                         { t(message, { seconds: timeLeft }) }
49 32
                     </div>
50 33
                 </div>
51
-                {
52
-                    this._renderButton()
53
-                }
54
-                {
55
-                    this._renderProgressBar()
56
-                }
34
+                { this._renderButton() }
35
+                { this._renderProgressBar() }
57 36
             </FilmstripOnlyOverlayFrame>
58 37
         );
59 38
     }

+ 0
- 17
react/features/overlay/components/PageReloadOverlay.js 查看文件

@@ -11,23 +11,6 @@ import OverlayFrame from './OverlayFrame';
11 11
  * reload.
12 12
  */
13 13
 class PageReloadOverlay extends AbstractPageReloadOverlay {
14
-    /**
15
-     * PageReloadOverlay component's property types.
16
-     *
17
-     * @static
18
-     */
19
-    static propTypes = {
20
-        ...AbstractPageReloadOverlay.propTypes,
21
-
22
-        /**
23
-         * The function to translate human-readable text.
24
-         *
25
-         * @public
26
-         * @type {Function}
27
-         */
28
-        t: React.PropTypes.func
29
-    };
30
-
31 14
     /**
32 15
      * Implements React's {@link Component#render()}.
33 16
      *

+ 2
- 1
react/features/overlay/components/ReloadButton.js 查看文件

@@ -34,8 +34,8 @@ class ReloadButton extends Component {
34 34
     /**
35 35
      * Renders the button for relaod the page if necessary.
36 36
      *
37
-     * @returns {ReactElement|null}
38 37
      * @private
38
+     * @returns {ReactElement}
39 39
      */
40 40
     render() {
41 41
         const className
@@ -54,6 +54,7 @@ class ReloadButton extends Component {
54 54
 
55 55
         /* eslint-enable react/jsx-handler-names */
56 56
     }
57
+}
57 58
 
58 59
 }
59 60
 

+ 1
- 2
react/features/overlay/components/SuspendedOverlay.js 查看文件

@@ -48,8 +48,7 @@ class SuspendedOverlay extends Component {
48 48
                             translateToHTML(t, 'suspendedoverlay.title')
49 49
                         }
50 50
                     </span>
51
-                    <ReloadButton
52
-                        textKey = 'suspendedoverlay.rejoinKeyTitle' />
51
+                    <ReloadButton textKey = 'suspendedoverlay.rejoinKeyTitle' />
53 52
                 </div>
54 53
             </OverlayFrame>
55 54
         );

+ 4
- 6
react/features/toolbox/components/Toolbar.web.js 查看文件

@@ -3,9 +3,7 @@
3 3
 import React, { Component } from 'react';
4 4
 import { connect } from 'react-redux';
5 5
 
6
-import {
7
-    setToolbarHovered
8
-} from '../actions';
6
+import { setToolbarHovered } from '../actions';
9 7
 import ToolbarButton from './ToolbarButton';
10 8
 
11 9
 /**
@@ -108,8 +106,8 @@ class Toolbar extends Component {
108 106
      * @param {Array} keyValuePair - Key value pair containing button and its
109 107
      * key.
110 108
      * @param {number} index - Index of the key value pair in the array.
111
-     * @returns {Array} Array of toolbar buttons and splitter if it's on.
112 109
      * @private
110
+     * @returns {Array} Array of toolbar buttons and splitter if it's on.
113 111
      */
114 112
     _renderToolbarButton(acc: Array<*>, keyValuePair: Array<*>,
115 113
                          index: number): Array<ReactElement<*>> {
@@ -153,8 +151,8 @@ class Toolbar extends Component {
153 151
  * Maps part of Redux actions to component's props.
154 152
  *
155 153
  * @param {Function} dispatch - Redux action dispatcher.
156
- * @returns {Object}
157 154
  * @private
155
+ * @returns {Object}
158 156
  */
159 157
 function _mapDispatchToProps(dispatch: Function): Object {
160 158
     return {
@@ -180,4 +178,4 @@ function _mapDispatchToProps(dispatch: Function): Object {
180 178
     };
181 179
 }
182 180
 
183
-export default connect(null, _mapDispatchToProps)(Toolbar);
181
+export default connect(undefined, _mapDispatchToProps)(Toolbar);

正在加载...
取消
保存