Comply w/ coding style

This commit is contained in:
Lyubo Marinov 2017-05-31 00:24:34 -05:00
parent 4dc658c270
commit 87b488a12b
12 changed files with 145 additions and 160 deletions

View File

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

View File

@ -79,7 +79,9 @@ function _obtainConfigAndInit() {
.catch(err => { .catch(err => {
// Show obtain config error. // Show obtain config error.
APP.UI.messageHandler.openReportDialog( APP.UI.messageHandler.openReportDialog(
null, 'dialog.connectError', err); null,
'dialog.connectError',
err);
}); });
} else { } else {
chooseBOSHAddress(config, room); chooseBOSHAddress(config, room);
@ -112,9 +114,7 @@ function _setTokenData() {
const { caller } = state['features/jwt']; const { caller } = state['features/jwt'];
if (caller) { if (caller) {
const email = caller.email; const { avatarUrl, email, name } = caller;
const avatarUrl = caller.avatarUrl;
const name = caller.name;
APP.settings.setEmail((email || '').trim(), true); APP.settings.setEmail((email || '').trim(), true);
APP.settings.setAvatarUrl((avatarUrl || '').trim()); APP.settings.setAvatarUrl((avatarUrl || '').trim());

View File

@ -10,11 +10,9 @@ import { updateDialInNumbers } from '../actions';
const logger = require('jitsi-meet-logger').getLogger(__filename); const logger = require('jitsi-meet-logger').getLogger(__filename);
const EXPAND_ICON = <ExpandIcon label = 'expand' />;
/** /**
* React {@code Component} responsible for fetching and displaying telephone * React {@code Component} responsible for fetching and displaying telephone
* numbers for dialing into the conference. Also supports copying a selected * numbers for dialing into a conference. Also supports copying a selected
* dial-in number to the clipboard. * dial-in number to the clipboard.
* *
* @extends Component * @extends Component
@ -105,8 +103,10 @@ class DialInNumbersForm extends Component {
* returns {void} * returns {void}
*/ */
componentWillMount() { componentWillMount() {
if (this.props._dialIn.numbers) { const { numbers } = this.props._dialIn;
this._setDefaultNumber(this.props._dialIn.numbers);
if (numbers) {
this._setDefaultNumber(numbers);
} else { } else {
this.props.dispatch(updateDialInNumbers()); this.props.dispatch(updateDialInNumbers());
} }
@ -209,7 +209,7 @@ class DialInNumbersForm extends Component {
type = 'text' type = 'text'
value = { triggerText || '' } /> value = { triggerText || '' } />
<span className = 'dial-in-numbers-trigger-icon'> <span className = 'dial-in-numbers-trigger-icon'>
{ EXPAND_ICON } <ExpandIcon label = 'expand' />
</span> </span>
</div> </div>
); );

View File

@ -4,14 +4,11 @@ import { connect } from 'react-redux';
import { Dialog } from '../../base/dialog'; import { Dialog } from '../../base/dialog';
import { translate } from '../../base/i18n'; import { translate } from '../../base/i18n';
import JitsiMeetJS from '../../base/lib-jitsi-meet'; import JitsiMeetJS from '../../base/lib-jitsi-meet';
import { import { getLocalParticipant, PARTICIPANT_ROLE } from '../../base/participants';
getLocalParticipant,
PARTICIPANT_ROLE
} from '../../base/participants';
import DialInNumbersForm from './DialInNumbersForm';
import PasswordContainer from './PasswordContainer'; import PasswordContainer from './PasswordContainer';
import ShareLinkForm from './ShareLinkForm'; import ShareLinkForm from './ShareLinkForm';
import DialInNumbersForm from './DialInNumbersForm';
/** /**
* A React {@code Component} for displaying other components responsible for * A React {@code Component} for displaying other components responsible for

View File

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

View File

@ -9,12 +9,12 @@ import {
* @param {boolean} isVisible - If the value is true - the prompt for media * @param {boolean} isVisible - If the value is true - the prompt for media
* permission is visible otherwise the value is false/undefined. * permission is visible otherwise the value is false/undefined.
* @param {string} browser - The name of the current browser. * @param {string} browser - The name of the current browser.
* @public
* @returns {{ * @returns {{
* type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED, * type: MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED,
* browser: {string}, * browser: {string},
* isVisible: {boolean} * isVisible: {boolean}
* }} * }}
* @public
*/ */
export function mediaPermissionPromptVisibilityChanged(isVisible, browser) { export function mediaPermissionPromptVisibilityChanged(isVisible, browser) {
return { return {
@ -27,10 +27,10 @@ export function mediaPermissionPromptVisibilityChanged(isVisible, browser) {
/** /**
* Signals that suspend was detected. * Signals that suspend was detected.
* *
* @public
* @returns {{ * @returns {{
* type: SUSPEND_DETECTED * type: SUSPEND_DETECTED
* }} * }}
* @public
*/ */
export function suspendDetected() { export function suspendDetected() {
return { return {

View File

@ -1,3 +1,5 @@
/* @flow */
import React, { Component } from 'react'; import React, { Component } from 'react';
import { randomInt } from '../../base/util'; import { randomInt } from '../../base/util';
@ -36,9 +38,51 @@ export default class AbstractPageReloadOverlay extends Component {
* @public * @public
* @type {string} * @type {string}
*/ */
reason: React.PropTypes.string reason: React.PropTypes.string,
/**
* The function to translate human-readable text.
*
* @public
* @type {Function}
*/
t: React.PropTypes.func
}; };
_interval: ?number
state: {
/**
* The translation key for the title of the overlay.
*
* @type {string}
*/
message: string,
/**
* Current value(time) of the timer.
*
* @type {number}
*/
timeLeft: number,
/**
* How long the overlay dialog will be displayed before the
* conference will be reloaded.
*
* @type {number}
*/
timeoutSeconds: number,
/**
* The translation key for the title of the overlay.
*
* @type {string}
*/
title: string
}
/** /**
* Initializes a new AbstractPageReloadOverlay instance. * Initializes a new AbstractPageReloadOverlay instance.
* *
@ -46,7 +90,7 @@ export default class AbstractPageReloadOverlay extends Component {
* instance is to be initialized. * instance is to be initialized.
* @public * @public
*/ */
constructor(props) { constructor(props: Object) {
super(props); super(props);
/** /**
@ -68,42 +112,87 @@ export default class AbstractPageReloadOverlay extends Component {
} }
this.state = { this.state = {
/**
* The translation key for the title of the overlay.
*
* @type {string}
*/
message, message,
/**
* Current value(time) of the timer.
*
* @type {number}
*/
timeLeft: timeoutSeconds, timeLeft: timeoutSeconds,
/**
* How long the overlay dialog will be displayed before the
* conference will be reloaded.
*
* @type {number}
*/
timeoutSeconds, timeoutSeconds,
/**
* The translation key for the title of the overlay.
*
* @type {string}
*/
title title
}; };
} }
/**
* React Component method that executes once component is mounted.
*
* @inheritdoc
* @returns {void}
*/
componentDidMount() {
// FIXME (CallStats - issue) This event will not make it to CallStats
// because the log queue is not flushed before "fabric terminated" is
// sent to the backed.
// FIXME: We should dispatch action for this.
APP.conference.logEvent(
'page.reload',
/* value */ undefined,
/* label */ this.props.reason);
logger.info(
`The conference will be reloaded after ${
this.state.timeoutSeconds} seconds.`);
AJS.progressBars.update('#reloadProgressBar', 0);
this._interval
= setInterval(
() => {
if (this.state.timeLeft === 0) {
if (this._interval) {
clearInterval(this._interval);
this._interval = undefined;
}
reconnectNow();
} else {
this.setState(prevState => {
return {
timeLeft: prevState.timeLeft - 1
};
});
}
},
1000);
}
/**
* React Component method that executes once component is updated.
*
* @inheritdoc
* @returns {void}
*/
componentDidUpdate() {
const { timeLeft, timeoutSeconds } = this.state;
AJS.progressBars.update(
'#reloadProgressBar',
(timeoutSeconds - timeLeft) / timeoutSeconds);
}
/**
* Clears the timer interval.
*
* @inheritdoc
* @returns {void}
*/
componentWillUnmount() {
if (this._interval) {
clearInterval(this._interval);
this._interval = undefined;
}
}
/** /**
* Renders the button for relaod the page if necessary. * Renders the button for relaod the page if necessary.
* *
* @protected
* @returns {ReactElement|null} * @returns {ReactElement|null}
* @private
*/ */
_renderButton() { _renderButton() {
if (this.props.isNetworkFailure) { if (this.props.isNetworkFailure) {
@ -118,8 +207,8 @@ export default class AbstractPageReloadOverlay extends Component {
/** /**
* Renders the progress bar. * Renders the progress bar.
* *
* @returns {ReactElement|null}
* @protected * @protected
* @returns {ReactElement}
*/ */
_renderProgressBar() { _renderProgressBar() {
return ( return (
@ -130,63 +219,4 @@ export default class AbstractPageReloadOverlay extends Component {
</div> </div>
); );
} }
/**
* React Component method that executes once component is mounted.
*
* @inheritdoc
* @returns {void}
* @protected
*/
componentDidMount() {
// FIXME (CallStats - issue) This event will not make it to CallStats
// because the log queue is not flushed before "fabric terminated" is
// sent to the backed.
// FIXME: We should dispatch action for this.
APP.conference.logEvent(
'page.reload',
/* value */ undefined,
/* label */ this.props.reason);
logger.info(
'The conference will be reloaded after '
+ `${this.state.timeoutSeconds} seconds.`);
AJS.progressBars.update('#reloadProgressBar', 0);
this.intervalId = setInterval(() => {
if (this.state.timeLeft === 0) {
clearInterval(this.intervalId);
reconnectNow();
} else {
this.setState(prevState => {
return {
timeLeft: prevState.timeLeft - 1
};
});
}
}, 1000);
}
/**
* React Component method that executes once component is updated.
*
* @inheritdoc
* @returns {void}
* @protected
*/
componentDidUpdate() {
AJS.progressBars.update('#reloadProgressBar',
(this.state.timeoutSeconds - this.state.timeLeft)
/ this.state.timeoutSeconds);
}
/**
* Clears the timer interval.
*
* @inheritdoc
* @returns {void}
*/
componentWillUnmount() {
clearInterval(this.intervalId);
}
} }

View File

@ -11,23 +11,6 @@ import FilmstripOnlyOverlayFrame from './FilmstripOnlyOverlayFrame';
* counts down towards the reload. * counts down towards the reload.
*/ */
class PageReloadFilmstripOnlyOverlay extends AbstractPageReloadOverlay { class PageReloadFilmstripOnlyOverlay extends AbstractPageReloadOverlay {
/**
* PageReloadFilmstripOnlyOverlay component's property types.
*
* @static
*/
static propTypes = {
...AbstractPageReloadOverlay.propTypes,
/**
* The function to translate human-readable text.
*
* @public
* @type {Function}
*/
t: React.PropTypes.func
};
/** /**
* Implements React's {@link Component#render()}. * Implements React's {@link Component#render()}.
* *
@ -48,12 +31,8 @@ class PageReloadFilmstripOnlyOverlay extends AbstractPageReloadOverlay {
{ t(message, { seconds: timeLeft }) } { t(message, { seconds: timeLeft }) }
</div> </div>
</div> </div>
{ { this._renderButton() }
this._renderButton() { this._renderProgressBar() }
}
{
this._renderProgressBar()
}
</FilmstripOnlyOverlayFrame> </FilmstripOnlyOverlayFrame>
); );
} }

View File

@ -11,23 +11,6 @@ import OverlayFrame from './OverlayFrame';
* reload. * reload.
*/ */
class PageReloadOverlay extends AbstractPageReloadOverlay { class PageReloadOverlay extends AbstractPageReloadOverlay {
/**
* PageReloadOverlay component's property types.
*
* @static
*/
static propTypes = {
...AbstractPageReloadOverlay.propTypes,
/**
* The function to translate human-readable text.
*
* @public
* @type {Function}
*/
t: React.PropTypes.func
};
/** /**
* Implements React's {@link Component#render()}. * Implements React's {@link Component#render()}.
* *

View File

@ -34,8 +34,8 @@ class ReloadButton extends Component {
/** /**
* Renders the button for relaod the page if necessary. * Renders the button for relaod the page if necessary.
* *
* @returns {ReactElement|null}
* @private * @private
* @returns {ReactElement}
*/ */
render() { render() {
const className const className
@ -54,6 +54,7 @@ class ReloadButton extends Component {
/* eslint-enable react/jsx-handler-names */ /* eslint-enable react/jsx-handler-names */
} }
}
} }

View File

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

View File

@ -3,9 +3,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { import { setToolbarHovered } from '../actions';
setToolbarHovered
} from '../actions';
import ToolbarButton from './ToolbarButton'; import ToolbarButton from './ToolbarButton';
/** /**
@ -108,8 +106,8 @@ class Toolbar extends Component {
* @param {Array} keyValuePair - Key value pair containing button and its * @param {Array} keyValuePair - Key value pair containing button and its
* key. * key.
* @param {number} index - Index of the key value pair in the array. * @param {number} index - Index of the key value pair in the array.
* @returns {Array} Array of toolbar buttons and splitter if it's on.
* @private * @private
* @returns {Array} Array of toolbar buttons and splitter if it's on.
*/ */
_renderToolbarButton(acc: Array<*>, keyValuePair: Array<*>, _renderToolbarButton(acc: Array<*>, keyValuePair: Array<*>,
index: number): Array<ReactElement<*>> { index: number): Array<ReactElement<*>> {
@ -153,8 +151,8 @@ class Toolbar extends Component {
* Maps part of Redux actions to component's props. * Maps part of Redux actions to component's props.
* *
* @param {Function} dispatch - Redux action dispatcher. * @param {Function} dispatch - Redux action dispatcher.
* @returns {Object}
* @private * @private
* @returns {Object}
*/ */
function _mapDispatchToProps(dispatch: Function): Object { function _mapDispatchToProps(dispatch: Function): Object {
return { return {
@ -180,4 +178,4 @@ function _mapDispatchToProps(dispatch: Function): Object {
}; };
} }
export default connect(null, _mapDispatchToProps)(Toolbar); export default connect(undefined, _mapDispatchToProps)(Toolbar);