Coding style
This commit is contained in:
parent
7fe421aeba
commit
447035c8b2
|
@ -31,7 +31,7 @@ export default class AlwaysOnTop extends Component<*, State> {
|
|||
_hovered: boolean;
|
||||
|
||||
/**
|
||||
* Initializes new AlwaysOnTop instance.
|
||||
* Initializes a new {@code AlwaysOnTop} instance.
|
||||
*
|
||||
* @param {*} props - The read-only properties with which the new instance
|
||||
* is to be initialized.
|
||||
|
|
|
@ -112,7 +112,7 @@ export default class AudioMuteButton
|
|||
* Indicates if audio is currently muted ot nor.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isAudioMuted() {
|
||||
|
@ -123,7 +123,7 @@ export default class AudioMuteButton
|
|||
* Indicates whether this button is disabled or not.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isDisabled() {
|
||||
|
@ -133,8 +133,9 @@ export default class AudioMuteButton
|
|||
/**
|
||||
* Changes the muted state.
|
||||
*
|
||||
* @override
|
||||
* @param {boolean} audioMuted - Whether audio should be muted or not.
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_setAudioMuted(audioMuted: boolean) { // eslint-disable-line no-unused-vars
|
||||
|
|
|
@ -13,7 +13,7 @@ export default class HangupButton extends AbstractHangupButton<Props, *> {
|
|||
* Helper function to perform the actual hangup action.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_doHangup() {
|
||||
|
|
|
@ -88,7 +88,7 @@ export default class VideoMuteButton
|
|||
* Indicates whether this button is disabled or not.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isDisabled() {
|
||||
|
@ -99,7 +99,7 @@ export default class VideoMuteButton
|
|||
* Indicates if video is currently muted ot nor.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isVideoMuted() {
|
||||
|
@ -109,8 +109,9 @@ export default class VideoMuteButton
|
|||
/**
|
||||
* Changes the muted state.
|
||||
*
|
||||
* @override
|
||||
* @param {boolean} videoMuted - Whether video should be muted or not.
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars
|
||||
|
|
|
@ -18,7 +18,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
|
|||
* accordingly.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_handleClick() {
|
||||
|
@ -29,8 +29,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
|
|||
* Helper function to be implemented by subclasses, which must return a
|
||||
* boolean value indicating if audio is muted or not.
|
||||
*
|
||||
* @abstract
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isAudioMuted() {
|
||||
|
@ -41,7 +40,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
|
|||
* Indicates whether this button is in toggled state or not.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isToggled() {
|
||||
|
@ -53,7 +52,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
|
|||
* action.
|
||||
*
|
||||
* @param {boolean} audioMuted - Whether video should be muted or not.
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_setAudioMuted(audioMuted: boolean) { // eslint-disable-line no-unused-vars
|
||||
|
|
|
@ -23,8 +23,7 @@ export type Props = {
|
|||
toggledStyles: ?Styles,
|
||||
|
||||
/**
|
||||
* From which direction the tooltip should appear, relative to the
|
||||
* button.
|
||||
* From which direction the tooltip should appear, relative to the button.
|
||||
*/
|
||||
tooltipPosition: string,
|
||||
|
||||
|
@ -87,11 +86,12 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
|
|||
* Initializes a new {@code AbstractButton} instance.
|
||||
*
|
||||
* @param {Props} props - The React {@code Component} props to initialize
|
||||
* the new {@code AbstractAudioMuteButton} instance with.
|
||||
* the new {@code AbstractButton} instance with.
|
||||
*/
|
||||
constructor(props: P) {
|
||||
super(props);
|
||||
|
||||
// Bind event handlers so they are only bound once per instance.
|
||||
this._onClick = this._onClick.bind(this);
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,7 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
|
|||
* Helper function to be implemented by subclasses, which should be used
|
||||
* to handle the button being clicked / pressed.
|
||||
*
|
||||
* @abstract
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_handleClick() {
|
||||
|
@ -138,7 +137,7 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
|
|||
* Helper function to be implemented by subclasses, which must return a
|
||||
* boolean value indicating if this button is disabled or not.
|
||||
*
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isDisabled() {
|
||||
|
@ -147,9 +146,9 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
|
|||
|
||||
/**
|
||||
* Helper function to be implemented by subclasses, which must return a
|
||||
* boolean value indicating if this button is toggled or not.
|
||||
* {@code boolean} value indicating if this button is toggled or not.
|
||||
*
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isToggled() {
|
||||
|
|
|
@ -15,7 +15,7 @@ export default class AbstractHangupButton<P : Props, S: *>
|
|||
/**
|
||||
* Handles clicking / pressing the button, and disconnects the conference.
|
||||
*
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_handleClick() {
|
||||
|
@ -25,8 +25,7 @@ export default class AbstractHangupButton<P : Props, S: *>
|
|||
/**
|
||||
* Helper function to perform the actual hangup action.
|
||||
*
|
||||
* @abstract
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_doHangup() {
|
||||
|
|
|
@ -150,11 +150,7 @@ export default class AbstractToolboxItem<P : Props> extends Component<P> {
|
|||
_maybeTranslateAttribute(text) {
|
||||
const { t } = this.props;
|
||||
|
||||
if (typeof t === 'function') {
|
||||
return t(text);
|
||||
}
|
||||
|
||||
return text;
|
||||
return typeof t === 'function' ? t(text) : text;
|
||||
}
|
||||
|
||||
_onClick: (*) => void;
|
||||
|
@ -169,7 +165,7 @@ export default class AbstractToolboxItem<P : Props> extends Component<P> {
|
|||
_onClick(...args) {
|
||||
const { disabled, onClick } = this.props;
|
||||
|
||||
!disabled && onClick && onClick(...args);
|
||||
disabled || (onClick && onClick(...args));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -189,10 +185,6 @@ export default class AbstractToolboxItem<P : Props> extends Component<P> {
|
|||
* @returns {ReactElement}
|
||||
*/
|
||||
render() {
|
||||
if (!this.props.visible) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this._renderItem();
|
||||
return this.props.visible ? this._renderItem() : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
|
|||
* Handles clicking / pressing the button, and toggles the video mute state
|
||||
* accordingly.
|
||||
*
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_handleClick() {
|
||||
|
@ -28,7 +28,7 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
|
|||
* Indicates whether this button is in toggled state or not.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isToggled() {
|
||||
|
@ -37,10 +37,9 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
|
|||
|
||||
/**
|
||||
* Helper function to be implemented by subclasses, which must return a
|
||||
* boolean value indicating if video is muted or not.
|
||||
* {@code boolean} value indicating if video is muted or not.
|
||||
*
|
||||
* @abstract
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isVideoMuted() {
|
||||
|
@ -52,7 +51,7 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
|
|||
* action.
|
||||
*
|
||||
* @param {boolean} videoMuted - Whether video should be muted or not.
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// @flow
|
||||
|
||||
export { default as AbstractAudioMuteButton } from './AbstractAudioMuteButton';
|
||||
export { default as AbstractButton } from './AbstractButton';
|
||||
export type { Props as AbstractButtonProps } from './AbstractButton';
|
||||
export { default as AbstractAudioMuteButton } from './AbstractAudioMuteButton';
|
||||
export { default as AbstractHangupButton } from './AbstractHangupButton';
|
||||
export { default as AbstractVideoMuteButton } from './AbstractVideoMuteButton';
|
||||
|
|
|
@ -104,12 +104,10 @@ class AudioRouteButton extends AbstractButton<Props, *> {
|
|||
* Implements React's {@link Component#render()}.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @returns {?ReactElement}
|
||||
* @returns {React$Node}
|
||||
*/
|
||||
render() {
|
||||
if (!MPVolumeView && !AudioRoutePickerDialog) {
|
||||
|
||||
// $FlowFixMe
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class PictureInPictureButton extends AbstractButton<Props, *> {
|
|||
/**
|
||||
* Handles clicking / pressing the button.
|
||||
*
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_handleClick() {
|
||||
|
@ -44,16 +44,10 @@ class PictureInPictureButton extends AbstractButton<Props, *> {
|
|||
* Implements React's {@link Component#render()}.
|
||||
*
|
||||
* @inheritdoc
|
||||
* @returns {?ReactElement}
|
||||
* @returns {React$Node}
|
||||
*/
|
||||
render() {
|
||||
if (!this.props._enabled) {
|
||||
|
||||
// $FlowFixMe
|
||||
return null;
|
||||
}
|
||||
|
||||
return super.render();
|
||||
return this.props._enabled ? super.render() : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,8 @@ class RoomLockButton extends AbstractButton<Props, *> {
|
|||
/**
|
||||
* Handles clicking / pressing the button.
|
||||
*
|
||||
* @private
|
||||
* @override
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_handleClick() {
|
||||
|
@ -49,7 +50,7 @@ class RoomLockButton extends AbstractButton<Props, *> {
|
|||
* Indicates whether this button is disabled or not.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isDisabled() {
|
||||
|
@ -60,7 +61,7 @@ class RoomLockButton extends AbstractButton<Props, *> {
|
|||
* Indicates whether this button is in toggled state or not.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isToggled() {
|
||||
|
|
|
@ -11,6 +11,9 @@ import { toggleSettings } from '../../../side-panel';
|
|||
|
||||
declare var interfaceConfig: Object;
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link SettingsButton}.
|
||||
*/
|
||||
type Props = AbstractButtonProps & {
|
||||
|
||||
/**
|
||||
|
@ -41,7 +44,7 @@ class SettingsButton extends AbstractButton<Props, *> {
|
|||
/**
|
||||
* Handles clicking / pressing the button, and opens the appropriate dialog.
|
||||
*
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_handleClick() {
|
||||
|
|
|
@ -13,6 +13,9 @@ import { AbstractAudioMuteButton } from '../../base/toolbox';
|
|||
import type { AbstractButtonProps } from '../../base/toolbox';
|
||||
import { isLocalTrackMuted } from '../../base/tracks';
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link AudioMuteButton}.
|
||||
*/
|
||||
type Props = AbstractButtonProps & {
|
||||
|
||||
/**
|
||||
|
@ -39,7 +42,7 @@ class AudioMuteButton extends AbstractAudioMuteButton<Props, *> {
|
|||
* Indicates if audio is currently muted ot nor.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isAudioMuted() {
|
||||
|
@ -50,7 +53,7 @@ class AudioMuteButton extends AbstractAudioMuteButton<Props, *> {
|
|||
* Changes the muted state.
|
||||
*
|
||||
* @param {boolean} audioMuted - Whether audio should be muted or not.
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_setAudioMuted(audioMuted: boolean) {
|
||||
|
|
|
@ -4,19 +4,21 @@ import { connect } from 'react-redux';
|
|||
|
||||
import { createToolbarEvent, sendAnalytics } from '../../analytics';
|
||||
import { appNavigate } from '../../app';
|
||||
|
||||
import { disconnect } from '../../base/connection';
|
||||
import { translate } from '../../base/i18n';
|
||||
import { AbstractHangupButton } from '../../base/toolbox';
|
||||
import type { AbstractButtonProps } from '../../base/toolbox';
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link HangupButton}.
|
||||
*/
|
||||
type Props = AbstractButtonProps & {
|
||||
|
||||
/**
|
||||
* The redux {@code dispatch} function.
|
||||
*/
|
||||
dispatch: Function
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Component that renders a toolbar button for leaving the current conference.
|
||||
|
@ -31,7 +33,7 @@ class HangupButton extends AbstractHangupButton<Props, *> {
|
|||
* Helper function to perform the actual hangup action.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_doHangup() {
|
||||
|
|
|
@ -17,6 +17,9 @@ import { AbstractVideoMuteButton } from '../../base/toolbox';
|
|||
import type { AbstractButtonProps } from '../../base/toolbox';
|
||||
import { isLocalTrackMuted } from '../../base/tracks';
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link VideoMuteButton}.
|
||||
*/
|
||||
type Props = AbstractButtonProps & {
|
||||
|
||||
/**
|
||||
|
@ -48,7 +51,7 @@ class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
|
|||
* Indicates if this button should be disabled or not.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isDisabled() {
|
||||
|
@ -59,7 +62,7 @@ class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
|
|||
* Indicates if video is currently muted ot nor.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isVideoMuted() {
|
||||
|
@ -69,8 +72,9 @@ class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
|
|||
/**
|
||||
* Changes the muted state.
|
||||
*
|
||||
* @override
|
||||
* @param {boolean} videoMuted - Whether video should be muted or not.
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_setVideoMuted(videoMuted: boolean) {
|
||||
|
|
|
@ -7,6 +7,9 @@ import { translate } from '../../../base/i18n';
|
|||
import { AbstractButton } from '../../../base/toolbox';
|
||||
import type { AbstractButtonProps } from '../../../base/toolbox';
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link AudioOnlyButton}.
|
||||
*/
|
||||
type Props = AbstractButtonProps & {
|
||||
|
||||
/**
|
||||
|
@ -32,7 +35,8 @@ class AudioOnlyButton extends AbstractButton<Props, *> {
|
|||
/**
|
||||
* Handles clicking / pressing the button.
|
||||
*
|
||||
* @private
|
||||
* @override
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_handleClick() {
|
||||
|
@ -43,7 +47,7 @@ class AudioOnlyButton extends AbstractButton<Props, *> {
|
|||
* Indicates whether this button is in toggled state or not.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isToggled() {
|
||||
|
|
|
@ -8,6 +8,9 @@ import { AbstractButton } from '../../../base/toolbox';
|
|||
import type { AbstractButtonProps } from '../../../base/toolbox';
|
||||
import { isLocalTrackMuted } from '../../../base/tracks';
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link ToggleCameraButton}.
|
||||
*/
|
||||
type Props = AbstractButtonProps & {
|
||||
|
||||
/**
|
||||
|
@ -37,7 +40,8 @@ class ToggleCameraButton extends AbstractButton<Props, *> {
|
|||
/**
|
||||
* Handles clicking / pressing the button.
|
||||
*
|
||||
* @private
|
||||
* @override
|
||||
* @protected
|
||||
* @returns {void}
|
||||
*/
|
||||
_handleClick() {
|
||||
|
@ -48,7 +52,7 @@ class ToggleCameraButton extends AbstractButton<Props, *> {
|
|||
* Indicates whether this button is disabled or not.
|
||||
*
|
||||
* @override
|
||||
* @private
|
||||
* @protected
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_isDisabled() {
|
||||
|
|
|
@ -169,7 +169,7 @@ class Toolbox extends Component<Props> {
|
|||
*
|
||||
* @param {Object} state - The redux state of which parts are to be mapped to
|
||||
* {@code Toolbox} props.
|
||||
* @protected
|
||||
* @private
|
||||
* @returns {{
|
||||
* _enabled: boolean,
|
||||
* _visible: boolean
|
||||
|
|
|
@ -50,6 +50,9 @@ import OverflowMenuProfileItem from './OverflowMenuProfileItem';
|
|||
import ToolbarButton from './ToolbarButton';
|
||||
import VideoMuteButton from '../VideoMuteButton';
|
||||
|
||||
/**
|
||||
* The type of the React {@code Component} props of {@link Toolbox}.
|
||||
*/
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
|
@ -169,7 +172,7 @@ type Props = {
|
|||
* Invoked to obtain translated strings.
|
||||
*/
|
||||
t: Function
|
||||
}
|
||||
};
|
||||
|
||||
declare var APP: Object;
|
||||
declare var interfaceConfig: Object;
|
||||
|
|
Loading…
Reference in New Issue