Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

Coding style

Lyubo Marinov447035c8b2b6
diff --git a/react/features/always-on-top/AlwaysOnTop.js b/react/features/always-on-top/AlwaysOnTop.js
index cea7db5a31..7e66009fed 100644
--- a/react/features/always-on-top/AlwaysOnTop.js
+++ b/react/features/always-on-top/AlwaysOnTop.js
@@ -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.
diff --git a/react/features/always-on-top/AudioMuteButton.js b/react/features/always-on-top/AudioMuteButton.js
index 337b44e96e..35d89bb48e 100644
--- a/react/features/always-on-top/AudioMuteButton.js
+++ b/react/features/always-on-top/AudioMuteButton.js
@@ -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
diff --git a/react/features/always-on-top/HangupButton.js b/react/features/always-on-top/HangupButton.js
index f4a8210753..c9e88b020e 100644
--- a/react/features/always-on-top/HangupButton.js
+++ b/react/features/always-on-top/HangupButton.js
@@ -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() {
diff --git a/react/features/always-on-top/VideoMuteButton.js b/react/features/always-on-top/VideoMuteButton.js
index 37e7d3971c..bd55779cca 100644
--- a/react/features/always-on-top/VideoMuteButton.js
+++ b/react/features/always-on-top/VideoMuteButton.js
@@ -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
diff --git a/react/features/base/toolbox/components/AbstractAudioMuteButton.js b/react/features/base/toolbox/components/AbstractAudioMuteButton.js
index 201b68340b..1a354603cd 100644
--- a/react/features/base/toolbox/components/AbstractAudioMuteButton.js
+++ b/react/features/base/toolbox/components/AbstractAudioMuteButton.js
@@ -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
diff --git a/react/features/base/toolbox/components/AbstractButton.js b/react/features/base/toolbox/components/AbstractButton.js
index ceaa09c501..908f05c592 100644
--- a/react/features/base/toolbox/components/AbstractButton.js
+++ b/react/features/base/toolbox/components/AbstractButton.js
@@ -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() {
diff --git a/react/features/base/toolbox/components/AbstractHangupButton.js b/react/features/base/toolbox/components/AbstractHangupButton.js
index 181ad07a01..8523496af7 100644
--- a/react/features/base/toolbox/components/AbstractHangupButton.js
+++ b/react/features/base/toolbox/components/AbstractHangupButton.js
@@ -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() {
diff --git a/react/features/base/toolbox/components/AbstractToolboxItem.js b/react/features/base/toolbox/components/AbstractToolboxItem.js
index 373688fbca..08cca5f2c7 100644
--- a/react/features/base/toolbox/components/AbstractToolboxItem.js
+++ b/react/features/base/toolbox/components/AbstractToolboxItem.js
@@ -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;
}
}
diff --git a/react/features/base/toolbox/components/AbstractVideoMuteButton.js b/react/features/base/toolbox/components/AbstractVideoMuteButton.js
index 7fe979851e..a31f0b24e3 100644
--- a/react/features/base/toolbox/components/AbstractVideoMuteButton.js
+++ b/react/features/base/toolbox/components/AbstractVideoMuteButton.js
@@ -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
diff --git a/react/features/base/toolbox/components/index.js b/react/features/base/toolbox/components/index.js
index 59444b1fd8..945aeadcde 100644
--- a/react/features/base/toolbox/components/index.js
+++ b/react/features/base/toolbox/components/index.js
@@ -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';
diff --git a/react/features/mobile/audio-mode/components/AudioRouteButton.js b/react/features/mobile/audio-mode/components/AudioRouteButton.js
index b34f7333eb..cfa5aab4d2 100644
--- a/react/features/mobile/audio-mode/components/AudioRouteButton.js
+++ b/react/features/mobile/audio-mode/components/AudioRouteButton.js
@@ -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;
}
diff --git a/react/features/mobile/picture-in-picture/components/PictureInPictureButton.js b/react/features/mobile/picture-in-picture/components/PictureInPictureButton.js
index e1f48ebc7c..537074c160 100644
--- a/react/features/mobile/picture-in-picture/components/PictureInPictureButton.js
+++ b/react/features/mobile/picture-in-picture/components/PictureInPictureButton.js
@@ -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;
}
}
diff --git a/react/features/room-lock/components/RoomLockButton.js b/react/features/room-lock/components/RoomLockButton.js
index b2b5ef1a6c..3b6aad9f8f 100644
--- a/react/features/room-lock/components/RoomLockButton.js
+++ b/react/features/room-lock/components/RoomLockButton.js
@@ -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() {
diff --git a/react/features/settings/components/web/SettingsButton.js b/react/features/settings/components/web/SettingsButton.js
index c7b330d18e..d4c7e98ccb 100644
--- a/react/features/settings/components/web/SettingsButton.js
+++ b/react/features/settings/components/web/SettingsButton.js
@@ -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() {
diff --git a/react/features/toolbox/components/AudioMuteButton.js b/react/features/toolbox/components/AudioMuteButton.js
index ba564b37a2..5228543ca9 100644
--- a/react/features/toolbox/components/AudioMuteButton.js
+++ b/react/features/toolbox/components/AudioMuteButton.js
@@ -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) {
diff --git a/react/features/toolbox/components/HangupButton.js b/react/features/toolbox/components/HangupButton.js
index 0b33a4813f..e1986d640a 100644
--- a/react/features/toolbox/components/HangupButton.js
+++ b/react/features/toolbox/components/HangupButton.js
@@ -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() {
diff --git a/react/features/toolbox/components/VideoMuteButton.js b/react/features/toolbox/components/VideoMuteButton.js
index ef97826374..f8bb062170 100644
--- a/react/features/toolbox/components/VideoMuteButton.js
+++ b/react/features/toolbox/components/VideoMuteButton.js
@@ -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) {
diff --git a/react/features/toolbox/components/native/AudioOnlyButton.js b/react/features/toolbox/components/native/AudioOnlyButton.js
index 5d2207faad..a98bb3286f 100644
--- a/react/features/toolbox/components/native/AudioOnlyButton.js
+++ b/react/features/toolbox/components/native/AudioOnlyButton.js
@@ -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() {
diff --git a/react/features/toolbox/components/native/ToggleCameraButton.js b/react/features/toolbox/components/native/ToggleCameraButton.js
index 369859b32d..de078d759e 100644
--- a/react/features/toolbox/components/native/ToggleCameraButton.js
+++ b/react/features/toolbox/components/native/ToggleCameraButton.js
@@ -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() {
diff --git a/react/features/toolbox/components/native/Toolbox.js b/react/features/toolbox/components/native/Toolbox.js
index f37104a66b..a6709dd4be 100644
--- a/react/features/toolbox/components/native/Toolbox.js
+++ b/react/features/toolbox/components/native/Toolbox.js
@@ -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
diff --git a/react/features/toolbox/components/web/Toolbox.js b/react/features/toolbox/components/web/Toolbox.js
index e68274c851..fb3b9bfcb8 100644
--- a/react/features/toolbox/components/web/Toolbox.js
+++ b/react/features/toolbox/components/web/Toolbox.js
@@ -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;