瀏覽代碼

Comply w/ coding style

master
Lyubo Marinov 8 年之前
父節點
當前提交
5a74080839

+ 2
- 2
react/features/base/dialog/components/AbstractDialog.js 查看文件

@@ -1,7 +1,7 @@
1 1
 import React, { Component } from 'react';
2 2
 
3 3
 import { hideDialog } from '../actions';
4
-import { dialogPropTypes } from '../constants';
4
+import { DIALOG_PROP_TYPES } from '../constants';
5 5
 
6 6
 /**
7 7
  * Abstract dialog to display dialogs.
@@ -14,7 +14,7 @@ export default class AbstractDialog extends Component {
14 14
      * @static
15 15
      */
16 16
     static propTypes = {
17
-        ...dialogPropTypes,
17
+        ...DIALOG_PROP_TYPES,
18 18
 
19 19
         /**
20 20
          * Used to show/hide the dialog on cancel.

+ 1
- 1
react/features/base/dialog/components/Dialog.native.js 查看文件

@@ -1,6 +1,6 @@
1 1
 import React from 'react';
2
-import { connect } from 'react-redux';
3 2
 import Prompt from 'react-native-prompt';
3
+import { connect } from 'react-redux';
4 4
 
5 5
 import { translate } from '../../i18n';
6 6
 

+ 38
- 40
react/features/base/dialog/components/StatelessDialog.web.js 查看文件

@@ -5,20 +5,19 @@ import React, { Component } from 'react';
5 5
 
6 6
 import { translate } from '../../i18n';
7 7
 
8
-import { dialogPropTypes } from '../constants';
8
+import { DIALOG_PROP_TYPES } from '../constants';
9 9
 
10 10
 /**
11 11
  * Web dialog that uses atlaskit modal-dialog to display dialogs.
12 12
  */
13 13
 class StatelessDialog extends Component {
14
-
15 14
     /**
16
-     * Web dialog component's property types.
15
+     * {@code StatelessDialog} component's property types.
17 16
      *
18 17
      * @static
19 18
      */
20 19
     static propTypes = {
21
-        ...dialogPropTypes,
20
+        ...DIALOG_PROP_TYPES,
22 21
 
23 22
         /**
24 23
          * This is the body of the dialog, the component children.
@@ -45,16 +44,15 @@ class StatelessDialog extends Component {
45 44
         /**
46 45
          * Width of the dialog, can be:
47 46
          * - 'small' (400px), 'medium' (600px), 'large' (800px),
48
-         * 'x-large' (968px)
47
+         *   'x-large' (968px)
49 48
          * - integer value for pixel width
50 49
          * - string value for percentage
51 50
          */
52 51
         width: React.PropTypes.string
53
-
54 52
     };
55 53
 
56 54
     /**
57
-     * Initializes a new Dialog instance.
55
+     * Initializes a new {@code StatelessDialog} instance.
58 56
      *
59 57
      * @param {Object} props - The read-only properties with which the new
60 58
      * instance is to be initialized.
@@ -62,6 +60,7 @@ class StatelessDialog extends Component {
62 60
     constructor(props) {
63 61
         super(props);
64 62
 
63
+        // Bind event handlers so they are only bound once for every instance.
65 64
         this._onCancel = this._onCancel.bind(this);
66 65
         this._onDialogDismissed = this._onDialogDismissed.bind(this);
67 66
         this._onSubmit = this._onSubmit.bind(this);
@@ -89,7 +88,19 @@ class StatelessDialog extends Component {
89 88
                         { this.props.children }
90 89
                     </form>
91 90
                 </div>
92
-            </ModalDialog>);
91
+            </ModalDialog>
92
+        );
93
+    }
94
+
95
+    /**
96
+     * Dispatches action to hide the dialog.
97
+     *
98
+     * @returns {void}
99
+     */
100
+    _onCancel() {
101
+        if (!this.props.isModal) {
102
+            this.props.onCancel();
103
+        }
93 104
     }
94 105
 
95 106
     /**
@@ -104,10 +115,21 @@ class StatelessDialog extends Component {
104 115
     }
105 116
 
106 117
     /**
107
-     * Render cancel button.
118
+     * Dispatches the action when submitting the dialog.
119
+     *
120
+     * @private
121
+     * @param {string} value - The submitted value if any.
122
+     * @returns {void}
123
+     */
124
+    _onSubmit(value) {
125
+        this.props.onSubmit(value);
126
+    }
127
+
128
+    /**
129
+     * Renders Cancel button.
108 130
      *
109
-     * @returns {*} The cancel button if enabled and dialog is not modal.
110 131
      * @private
132
+     * @returns {*} The Cancel button if enabled and dialog is not modal.
111 133
      */
112 134
     _renderCancelButton() {
113 135
         if (this.props.cancelDisabled || this.props.isModal) {
@@ -125,10 +147,10 @@ class StatelessDialog extends Component {
125 147
     }
126 148
 
127 149
     /**
128
-     * Render component in dialog footer.
150
+     * Renders component in dialog footer.
129 151
      *
130
-     * @returns {ReactElement}
131 152
      * @private
153
+     * @returns {ReactElement}
132 154
      */
133 155
     _renderFooter() {
134 156
         return (
@@ -142,10 +164,10 @@ class StatelessDialog extends Component {
142 164
     }
143 165
 
144 166
     /**
145
-     * Render component in dialog header.
167
+     * Renders component in dialog header.
146 168
      *
147
-     * @returns {ReactElement}
148 169
      * @private
170
+     * @returns {ReactElement}
149 171
      */
150 172
     _renderHeader() {
151 173
         const { t } = this.props;
@@ -160,10 +182,10 @@ class StatelessDialog extends Component {
160 182
     }
161 183
 
162 184
     /**
163
-     * Render ok button.
185
+     * Renders OK button.
164 186
      *
165
-     * @returns {*} The ok button if enabled.
166 187
      * @private
188
+     * @returns {*} The OK button if enabled.
167 189
      */
168 190
     _renderOKButton() {
169 191
         if (this.props.submitDisabled) {
@@ -181,30 +203,6 @@ class StatelessDialog extends Component {
181 203
             </AKButton>
182 204
         );
183 205
     }
184
-
185
-    /**
186
-     * Dispatches action to hide the dialog.
187
-     *
188
-     * @returns {void}
189
-     */
190
-    _onCancel() {
191
-        if (this.props.isModal) {
192
-            return;
193
-        }
194
-
195
-        this.props.onCancel();
196
-    }
197
-
198
-    /**
199
-     * Dispatches the action when submitting the dialog.
200
-     *
201
-     * @private
202
-     * @param {string} value - The submitted value if any.
203
-     * @returns {void}
204
-     */
205
-    _onSubmit(value) {
206
-        this.props.onSubmit(value);
207
-    }
208 206
 }
209 207
 
210 208
 export default translate(StatelessDialog);

+ 1
- 1
react/features/base/dialog/constants.js 查看文件

@@ -1,6 +1,6 @@
1 1
 import React from 'react';
2 2
 
3
-export const dialogPropTypes = {
3
+export const DIALOG_PROP_TYPES = {
4 4
     /**
5 5
      * Whether cancel button is disabled. Enabled by default.
6 6
      */

+ 4
- 7
react/features/dial-out/components/CountryIcon.js 查看文件

@@ -1,9 +1,9 @@
1 1
 import React, { Component } from 'react';
2 2
 
3 3
 /**
4
- * Implements a React Component to render a country flag icon.
4
+ * Implements a React {@link Component} to render a country flag icon.
5 5
  */
6
-class CountryIcon extends Component {
6
+export default class CountryIcon extends Component {
7 7
     /**
8 8
      * {@code CountryIcon}'s property types.
9 9
      *
@@ -29,12 +29,9 @@ class CountryIcon extends Component {
29 29
      */
30 30
     render() {
31 31
         const iconClassName
32
-            = `flag-icon flag-icon-${this.props.countryCode}
33
-             flag-icon-squared ${this.props.className}`;
32
+            = `flag-icon flag-icon-${this.props.countryCode
33
+                } flag-icon-squared ${this.props.className}`;
34 34
 
35 35
         return <span className = { iconClassName } />;
36
-
37 36
     }
38 37
 }
39
-
40
-export default CountryIcon;

+ 6
- 6
react/features/dial-out/components/DialOutDialog.web.js 查看文件

@@ -8,11 +8,10 @@ import { cancel, checkDialNumber, dial } from '../actions';
8 8
 import DialOutNumbersForm from './DialOutNumbersForm';
9 9
 
10 10
 /**
11
- * Implements a React Component which allows the user to dial out from the
12
- * conference.
11
+ * Implements a React {@link Component} which allows the user to dial out from
12
+ * the conference.
13 13
  */
14 14
 class DialOutDialog extends Component {
15
-
16 15
     /**
17 16
      * {@code DialOutDialog} component's property types.
18 17
      *
@@ -91,7 +90,8 @@ class DialOutDialog extends Component {
91 90
                 titleKey = 'dialOut.dialOut'
92 91
                 width = 'small'>
93 92
                 { this._renderContent() }
94
-            </Dialog>);
93
+            </Dialog>
94
+        );
95 95
     }
96 96
 
97 97
     /**
@@ -221,6 +221,6 @@ function _mapStateToProps(state) {
221 221
 export default translate(
222 222
     connect(_mapStateToProps, {
223 223
         cancel,
224
-        dial,
225
-        checkDialNumber
224
+        checkDialNumber,
225
+        dial
226 226
     })(DialOutDialog));

+ 24
- 22
react/features/dial-out/components/DialOutNumbersForm.web.js 查看文件

@@ -1,30 +1,35 @@
1
+import { StatelessDropdownMenu } from '@atlaskit/dropdown-menu';
2
+import ExpandIcon from '@atlaskit/icon/glyph/expand';
1 3
 import React, { Component } from 'react';
2 4
 import { connect } from 'react-redux';
3
-import ExpandIcon from '@atlaskit/icon/glyph/expand';
4
-import { StatelessDropdownMenu } from '@atlaskit/dropdown-menu';
5 5
 
6 6
 import { translate } from '../../base/i18n';
7
-import CountryIcon from './CountryIcon';
8
-import { updateDialOutCodes } from '../actions';
9 7
 
10
-/**
11
- * The expand icon of the dropdown menu.
12
- *
13
- * @type {XML}
14
- */
15
-const EXPAND_ICON = <ExpandIcon label = 'expand' />;
8
+import { updateDialOutCodes } from '../actions';
9
+import CountryIcon from './CountryIcon';
16 10
 
17 11
 /**
18 12
  * The default value of the country if the fetch service is unavailable.
19 13
  *
20
- * @type {{name: string, dialCode: string, code: string}}
14
+ * @type {{
15
+ *     code: string,
16
+ *     dialCode: string,
17
+ *     name: string
18
+ * }}
21 19
  */
22 20
 const DEFAULT_COUNTRY = {
23
-    name: 'United States',
21
+    code: 'US',
24 22
     dialCode: '+1',
25
-    code: 'US'
23
+    name: 'United States'
26 24
 };
27 25
 
26
+/**
27
+ * The expand icon of the dropdown menu.
28
+ *
29
+ * @type {ReactElement}
30
+ */
31
+const EXPAND_ICON = <ExpandIcon label = 'expand' />;
32
+
28 33
 /**
29 34
  * React {@code Component} responsible for fetching and displaying dial-out
30 35
  * country codes, as well as dialing a phone number.
@@ -108,7 +113,7 @@ class DialOutNumbersForm extends Component {
108 113
      * display in the dropdown trigger.
109 114
      *
110 115
      * @inheritdoc
111
-     * returns {void}
116
+     * @returns {void}
112 117
      */
113 118
     componentDidMount() {
114 119
         const dialOutCodes = this.props._dialOutCodes;
@@ -125,7 +130,7 @@ class DialOutNumbersForm extends Component {
125 130
      * the dropdown trigger if not already set.
126 131
      *
127 132
      * @inheritdoc
128
-     * returns {void}
133
+     * @returns {void}
129 134
      */
130 135
     componentWillReceiveProps(nextProps) {
131 136
         if (!this.state.selectedCountry && nextProps._dialOutCodes) {
@@ -141,7 +146,6 @@ class DialOutNumbersForm extends Component {
141 146
      */
142 147
     render() {
143 148
         const { t, _dialOutCodes } = this.props;
144
-
145 149
         const items
146 150
             = _dialOutCodes ? this._formatCountryCodes(_dialOutCodes) : [];
147 151
 
@@ -219,18 +223,16 @@ class DialOutNumbersForm extends Component {
219 223
      * @returns {Array<Object>}
220 224
      */
221 225
     _formatCountryCodes(countryCodes) {
222
-
223 226
         return countryCodes.map(country => {
224 227
             const countryIcon
225 228
                 = <CountryIcon countryCode = { `${country.code}` } />;
226
-
227 229
             const countryElement
228 230
                 = <span>{countryIcon} { country.name }</span>;
229 231
 
230 232
             return {
231 233
                 content: `${country.dialCode}`,
232
-                elemBefore: countryElement,
233
-                country
234
+                country,
235
+                elemBefore: countryElement
234 236
             };
235 237
         });
236 238
     }
@@ -342,5 +344,5 @@ function _mapStateToProps(state) {
342 344
     };
343 345
 }
344 346
 
345
-export default translate(connect(_mapStateToProps,
346
-    { updateDialOutCodes })(DialOutNumbersForm));
347
+export default translate(
348
+    connect(_mapStateToProps, { updateDialOutCodes })(DialOutNumbersForm));

Loading…
取消
儲存