浏览代码

Comply w/ coding style

master
Lyubo Marinov 8 年前
父节点
当前提交
5a74080839

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

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

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

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

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

5
 
5
 
6
 import { translate } from '../../i18n';
6
 import { translate } from '../../i18n';
7
 
7
 
8
-import { dialogPropTypes } from '../constants';
8
+import { DIALOG_PROP_TYPES } from '../constants';
9
 
9
 
10
 /**
10
 /**
11
  * Web dialog that uses atlaskit modal-dialog to display dialogs.
11
  * Web dialog that uses atlaskit modal-dialog to display dialogs.
12
  */
12
  */
13
 class StatelessDialog extends Component {
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
      * @static
17
      * @static
19
      */
18
      */
20
     static propTypes = {
19
     static propTypes = {
21
-        ...dialogPropTypes,
20
+        ...DIALOG_PROP_TYPES,
22
 
21
 
23
         /**
22
         /**
24
          * This is the body of the dialog, the component children.
23
          * This is the body of the dialog, the component children.
45
         /**
44
         /**
46
          * Width of the dialog, can be:
45
          * Width of the dialog, can be:
47
          * - 'small' (400px), 'medium' (600px), 'large' (800px),
46
          * - 'small' (400px), 'medium' (600px), 'large' (800px),
48
-         * 'x-large' (968px)
47
+         *   'x-large' (968px)
49
          * - integer value for pixel width
48
          * - integer value for pixel width
50
          * - string value for percentage
49
          * - string value for percentage
51
          */
50
          */
52
         width: React.PropTypes.string
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
      * @param {Object} props - The read-only properties with which the new
57
      * @param {Object} props - The read-only properties with which the new
60
      * instance is to be initialized.
58
      * instance is to be initialized.
62
     constructor(props) {
60
     constructor(props) {
63
         super(props);
61
         super(props);
64
 
62
 
63
+        // Bind event handlers so they are only bound once for every instance.
65
         this._onCancel = this._onCancel.bind(this);
64
         this._onCancel = this._onCancel.bind(this);
66
         this._onDialogDismissed = this._onDialogDismissed.bind(this);
65
         this._onDialogDismissed = this._onDialogDismissed.bind(this);
67
         this._onSubmit = this._onSubmit.bind(this);
66
         this._onSubmit = this._onSubmit.bind(this);
89
                         { this.props.children }
88
                         { this.props.children }
90
                     </form>
89
                     </form>
91
                 </div>
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
     }
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
      * @private
131
      * @private
132
+     * @returns {*} The Cancel button if enabled and dialog is not modal.
111
      */
133
      */
112
     _renderCancelButton() {
134
     _renderCancelButton() {
113
         if (this.props.cancelDisabled || this.props.isModal) {
135
         if (this.props.cancelDisabled || this.props.isModal) {
125
     }
147
     }
126
 
148
 
127
     /**
149
     /**
128
-     * Render component in dialog footer.
150
+     * Renders component in dialog footer.
129
      *
151
      *
130
-     * @returns {ReactElement}
131
      * @private
152
      * @private
153
+     * @returns {ReactElement}
132
      */
154
      */
133
     _renderFooter() {
155
     _renderFooter() {
134
         return (
156
         return (
142
     }
164
     }
143
 
165
 
144
     /**
166
     /**
145
-     * Render component in dialog header.
167
+     * Renders component in dialog header.
146
      *
168
      *
147
-     * @returns {ReactElement}
148
      * @private
169
      * @private
170
+     * @returns {ReactElement}
149
      */
171
      */
150
     _renderHeader() {
172
     _renderHeader() {
151
         const { t } = this.props;
173
         const { t } = this.props;
160
     }
182
     }
161
 
183
 
162
     /**
184
     /**
163
-     * Render ok button.
185
+     * Renders OK button.
164
      *
186
      *
165
-     * @returns {*} The ok button if enabled.
166
      * @private
187
      * @private
188
+     * @returns {*} The OK button if enabled.
167
      */
189
      */
168
     _renderOKButton() {
190
     _renderOKButton() {
169
         if (this.props.submitDisabled) {
191
         if (this.props.submitDisabled) {
181
             </AKButton>
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
 export default translate(StatelessDialog);
208
 export default translate(StatelessDialog);

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

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

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

1
 import React, { Component } from 'react';
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
      * {@code CountryIcon}'s property types.
8
      * {@code CountryIcon}'s property types.
9
      *
9
      *
29
      */
29
      */
30
     render() {
30
     render() {
31
         const iconClassName
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
         return <span className = { iconClassName } />;
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
 import DialOutNumbersForm from './DialOutNumbersForm';
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
 class DialOutDialog extends Component {
14
 class DialOutDialog extends Component {
15
-
16
     /**
15
     /**
17
      * {@code DialOutDialog} component's property types.
16
      * {@code DialOutDialog} component's property types.
18
      *
17
      *
91
                 titleKey = 'dialOut.dialOut'
90
                 titleKey = 'dialOut.dialOut'
92
                 width = 'small'>
91
                 width = 'small'>
93
                 { this._renderContent() }
92
                 { this._renderContent() }
94
-            </Dialog>);
93
+            </Dialog>
94
+        );
95
     }
95
     }
96
 
96
 
97
     /**
97
     /**
221
 export default translate(
221
 export default translate(
222
     connect(_mapStateToProps, {
222
     connect(_mapStateToProps, {
223
         cancel,
223
         cancel,
224
-        dial,
225
-        checkDialNumber
224
+        checkDialNumber,
225
+        dial
226
     })(DialOutDialog));
226
     })(DialOutDialog));

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

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

正在加载...
取消
保存