Skip to content

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

ref(TS) Convert some components to TS (#13129)

Robert Pintilii206a4afd76c3
diff --git a/react/features/base/conference/reducer.ts b/react/features/base/conference/reducer.ts
index c04e388ede..647162637e 100644
--- a/react/features/base/conference/reducer.ts
+++ b/react/features/base/conference/reducer.ts
@@ -63,6 +63,7 @@ export interface IJitsiConference {
getParticipants: Function;
getRole: Function;
getSpeakerStats: () => ISpeakerStats;
+ getSsrcByTrack: Function;
grantOwner: Function;
isAVModerationSupported: Function;
isCallstatsEnabled: Function;
diff --git a/react/features/base/toolbox/components/AbstractAudioMuteButton.ts b/react/features/base/toolbox/components/AbstractAudioMuteButton.ts
index e745e83033..bf8db80d94 100644
--- a/react/features/base/toolbox/components/AbstractAudioMuteButton.ts
+++ b/react/features/base/toolbox/components/AbstractAudioMuteButton.ts
@@ -5,7 +5,7 @@ import AbstractButton, { IProps } from './AbstractButton';
/**
* An abstract implementation of a button for toggling audio mute.
*/
-export default class AbstractAudioMuteButton<P extends IProps, S>
+export default class AbstractAudioMuteButton<P extends IProps, S=any>
extends AbstractButton<P, S> {
icon = IconMic;
diff --git a/react/features/base/toolbox/components/AbstractHangupButton.ts b/react/features/base/toolbox/components/AbstractHangupButton.ts
index 74cc0c5cb7..fd7d8f9b3d 100644
--- a/react/features/base/toolbox/components/AbstractHangupButton.ts
+++ b/react/features/base/toolbox/components/AbstractHangupButton.ts
@@ -5,7 +5,7 @@ import AbstractButton, { IProps } from './AbstractButton';
/**
* An abstract implementation of a button for disconnecting a conference.
*/
-export default class AbstractHangupButton<P extends IProps, S>
+export default class AbstractHangupButton<P extends IProps, S=any>
extends AbstractButton<P, S> {
icon = IconHangup;
diff --git a/react/features/base/toolbox/components/AbstractVideoMuteButton.ts b/react/features/base/toolbox/components/AbstractVideoMuteButton.ts
index 730d86352d..36e3f806f0 100644
--- a/react/features/base/toolbox/components/AbstractVideoMuteButton.ts
+++ b/react/features/base/toolbox/components/AbstractVideoMuteButton.ts
@@ -5,7 +5,7 @@ import AbstractButton, { IProps } from './AbstractButton';
/**
* An abstract implementation of a button for toggling video mute.
*/
-export default class AbstractVideoMuteButton<P extends IProps, S>
+export default class AbstractVideoMuteButton<P extends IProps, S=any>
extends AbstractButton<P, S> {
icon = IconVideo;
diff --git a/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.js b/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx
similarity index 83%
rename from react/features/base/toolbox/components/web/ToolboxButtonWithIcon.js
rename to react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx
index c7e2ea6070..bedb00213d 100644
--- a/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.js
+++ b/react/features/base/toolbox/components/web/ToolboxButtonWithIcon.tsx
@@ -1,86 +1,82 @@
-// @flow
-
import React from 'react';
import { NOTIFY_CLICK_MODE } from '../../../../toolbox/constants';
-import { Icon } from '../../../icons';
+import Icon from '../../../icons/components/Icon';
import Tooltip from '../../../tooltip/components/Tooltip';
-type Props = {
+interface IProps {
/**
- * The button's key.
+ * The id of the element this button icon controls.
*/
- buttonKey?: string,
+ ariaControls?: string;
/**
- * The decorated component (ToolboxButton).
+ * Whether the element popup is expanded.
*/
- children: React$Node,
+ ariaExpanded?: boolean;
/**
- * Icon of the button.
+ * Whether the element has a popup.
*/
- icon: Function,
+ ariaHasPopup?: boolean;
/**
- * Flag used for disabling the small icon.
+ * Aria label for the Icon.
*/
- iconDisabled: boolean,
+ ariaLabel?: string;
/**
- * Notify mode for `toolbarButtonClicked` event -
- * whether to only notify or to also prevent button click routine.
+ * The button's key.
*/
- notifyMode?: string,
+ buttonKey?: string;
/**
- * Click handler for the small icon.
+ * The decorated component (ToolboxButton).
*/
- onIconClick: Function,
+ children: React.ReactNode;
/**
- * The tooltip used for the icon.
+ * Icon of the button.
*/
- iconTooltip: string,
+ icon: Function;
/**
- * Additional styles.
+ * Flag used for disabling the small icon.
*/
- styles?: Object,
+ iconDisabled: boolean;
/**
- * Aria label for the Icon.
+ * The ID of the icon button.
*/
- ariaLabel?: string,
+ iconId: string;
/**
- * Whether the element has a popup.
+ * The tooltip used for the icon.
*/
- ariaHasPopup?: boolean,
+ iconTooltip: string;
/**
- * Whether the element popup is expanded.
+ * Notify mode for `toolbarButtonClicked` event -
+ * whether to only notify or to also prevent button click routine.
*/
- ariaExpanded?: boolean,
+ notifyMode?: string;
/**
- * The id of the element this button icon controls.
+ * Click handler for the small icon.
*/
- ariaControls?: string,
+ onIconClick: Function;
/**
* Keydown handler for icon.
*/
- onIconKeyDown?: Function,
+ onIconKeyDown?: Function;
/**
- * The ID of the icon button.
+ * Additional styles.
*/
- iconId: string
-};
-
-declare var APP: Object;
+ styles?: Object;
+}
/**
* Displays the `ToolboxButtonWithIcon` component.
@@ -88,7 +84,7 @@ declare var APP: Object;
* @param {Object} props - Component's props.
* @returns {ReactElement}
*/
-export default function ToolboxButtonWithIcon(props: Props) {
+export default function ToolboxButtonWithIcon(props: IProps) {
const {
children,
icon,
@@ -106,7 +102,7 @@ export default function ToolboxButtonWithIcon(props: Props) {
iconId
} = props;
- const iconProps = {};
+ const iconProps: any = {};
let className = '';
if (iconDisabled) {
@@ -137,7 +133,7 @@ export default function ToolboxButtonWithIcon(props: Props) {
return (
<div
className = 'settings-button-container'
- styles = { styles }>
+ style = { styles }>
{children}
<div>
diff --git a/react/features/chat/components/web/ChatButton.js b/react/features/chat/components/web/ChatButton.tsx
similarity index 76%
rename from react/features/chat/components/web/ChatButton.js
rename to react/features/chat/components/web/ChatButton.tsx
index 37b500bd7c..d7fbf2ed54 100644
--- a/react/features/chat/components/web/ChatButton.js
+++ b/react/features/chat/components/web/ChatButton.tsx
@@ -1,29 +1,28 @@
-// @flow
-
import React from 'react';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconMessage } from '../../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
+import { IReduxState } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { IconMessage } from '../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import ChatCounter from './ChatCounter';
/**
* The type of the React {@code Component} props of {@link ChatButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether or not the chat feature is currently displayed.
*/
- _chatOpen: boolean,
-};
+ _chatOpen: boolean;
+}
/**
* Implementation of a button for accessing chat pane.
*/
-class ChatButton extends AbstractButton<Props, *> {
+class ChatButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.openChat';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeChat';
icon = IconMessage;
@@ -50,7 +49,7 @@ class ChatButton extends AbstractButton<Props, *> {
* @protected
* @returns {boReact$Nodeolean}
*/
- render(): React$Node {
+ render() {
return (
<div
className = 'toolbar-button-with-badge'
@@ -68,7 +67,7 @@ class ChatButton extends AbstractButton<Props, *> {
* @param {Object} state - Redux state.
* @returns {Object}
*/
-const mapStateToProps = state => {
+const mapStateToProps = (state: IReduxState) => {
return {
_chatOpen: state['features/chat'].isOpen
};
diff --git a/react/features/chat/components/web/ChatCounter.js b/react/features/chat/components/web/ChatCounter.tsx
similarity index 87%
rename from react/features/chat/components/web/ChatCounter.js
rename to react/features/chat/components/web/ChatCounter.tsx
index c52bb3d8e0..491eeaad3c 100644
--- a/react/features/chat/components/web/ChatCounter.js
+++ b/react/features/chat/components/web/ChatCounter.tsx
@@ -1,26 +1,25 @@
-// @flow
-
import React, { Component } from 'react';
import { connect } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import { getUnreadPollCount } from '../../../polls/functions';
import { getUnreadCount } from '../../functions';
/**
* The type of the React {@code Component} props of {@link ChatCounter}.
*/
-type Props = {
+interface IProps {
/**
* The value of to display as a count.
*/
- _count: number,
+ _count: number;
/**
* True if the chat window should be rendered.
*/
- _isOpen: boolean
-};
+ _isOpen: boolean;
+}
/**
* Implements a React {@link Component} which displays a count of the number of
@@ -28,7 +27,7 @@ type Props = {
*
* @augments Component
*/
-class ChatCounter extends Component<Props> {
+class ChatCounter extends Component<IProps> {
/**
* Implements React's {@link Component#render()}.
@@ -61,7 +60,7 @@ class ChatCounter extends Component<Props> {
* _count: number
* }}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
const { isOpen } = state['features/chat'];
return {
diff --git a/react/features/chat/components/web/PrivateMessageButton.tsx b/react/features/chat/components/web/PrivateMessageButton.tsx
index d4423c79bc..1e1bf52319 100644
--- a/react/features/chat/components/web/PrivateMessageButton.tsx
+++ b/react/features/chat/components/web/PrivateMessageButton.tsx
@@ -11,7 +11,7 @@ import Button from '../../../base/ui/components/web/Button';
import { BUTTON_TYPES } from '../../../base/ui/constants.any';
import { handleLobbyChatInitialized, openChat } from '../../actions.web';
-interface IProps {
+export interface IProps {
/**
* True if the message is a lobby chat message.
diff --git a/react/features/connection-indicator/components/AbstractConnectionIndicator.ts b/react/features/connection-indicator/components/AbstractConnectionIndicator.ts
index 637e1f5e31..123e680f7b 100644
--- a/react/features/connection-indicator/components/AbstractConnectionIndicator.ts
+++ b/react/features/connection-indicator/components/AbstractConnectionIndicator.ts
@@ -59,7 +59,17 @@ export interface IState {
* mixed in with cached stats and a new stats object is set in state.
*/
stats: {
+ bandwidth?: any;
+ bitrate?: any;
+ bridgeCount?: any;
+ codec?: any;
+ framerate?: any;
+ maxEnabledResolution?: any;
+ packetLoss?: any;
percent?: number;
+ resolution?: any;
+ serverRegion?: any;
+ transport?: any;
};
}
diff --git a/react/features/connection-indicator/components/web/ConnectionIndicatorContent.js b/react/features/connection-indicator/components/web/ConnectionIndicatorContent.tsx
similarity index 82%
rename from react/features/connection-indicator/components/web/ConnectionIndicatorContent.js
rename to react/features/connection-indicator/components/web/ConnectionIndicatorContent.tsx
index 86ffb03593..d8d84f9997 100644
--- a/react/features/connection-indicator/components/web/ConnectionIndicatorContent.js
+++ b/react/features/connection-indicator/components/web/ConnectionIndicatorContent.tsx
@@ -1,25 +1,28 @@
-// @flow
-
import React from 'react';
+import { WithTranslation } from 'react-i18next';
import { connect } from 'react-redux';
-import type { Dispatch } from 'redux';
-import { translate } from '../../../base/i18n';
-import { MEDIA_TYPE } from '../../../base/media';
-import { getLocalParticipant, getParticipantById, isScreenShareParticipant } from '../../../base/participants';
+import { IReduxState, IStore } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { MEDIA_TYPE } from '../../../base/media/constants';
+import {
+ getLocalParticipant,
+ getParticipantById,
+ isScreenShareParticipant
+} from '../../../base/participants/functions';
import {
getTrackByMediaTypeAndParticipant,
getVirtualScreenshareParticipantTrack
-} from '../../../base/tracks/functions';
-import { ConnectionStatsTable } from '../../../connection-stats';
-import { saveLogs } from '../../actions';
+} from '../../../base/tracks/functions.web';
+import ConnectionStatsTable from '../../../connection-stats/components/ConnectionStatsTable';
+import { saveLogs } from '../../actions.web';
import {
isTrackStreamingStatusInactive,
isTrackStreamingStatusInterrupted
} from '../../functions';
import AbstractConnectionIndicator, {
- type Props as AbstractProps,
- type State as AbstractState,
+ IProps as AbstractProps,
+ IState as AbstractState,
INDICATOR_DISPLAY_THRESHOLD
} from '../AbstractConnectionIndicator';
@@ -30,7 +33,7 @@ import AbstractConnectionIndicator, {
*
* @type {Object[]}
*/
-const QUALITY_TO_WIDTH: Array<Object> = [
+const QUALITY_TO_WIDTH = [
// Full (3 bars)
{
@@ -62,81 +65,84 @@ const QUALITY_TO_WIDTH: Array<Object> = [
/**
* The type of the React {@code Component} props of {@link ConnectionIndicator}.
*/
-type Props = AbstractProps & {
+interface IProps extends AbstractProps, WithTranslation {
/**
* The audio SSRC of this client.
*/
- _audioSsrc: number,
+ _audioSsrc: number;
/**
* Whether or not should display the "Show More" link in the local video
* stats table.
*/
- _disableShowMoreStats: boolean,
+ _disableShowMoreStats: boolean;
/**
* Whether or not should display the "Save Logs" link in the local video
* stats table.
*/
- _enableSaveLogs: boolean,
+ _enableSaveLogs: boolean;
+
+ _isConnectionStatusInactive: boolean;
+
+ _isConnectionStatusInterrupted: boolean;
+
+ _isE2EEVerified: boolean;
/**
- * Whether is narrow layout or not.
+ * Whether or not the displays stats are for local video.
*/
- _isNarrowLayout: boolean,
+ _isLocalVideo: boolean;
/**
- * Whether or not the displays stats are for local video.
+ * Whether is narrow layout or not.
*/
- _isLocalVideo: boolean,
+ _isNarrowLayout: boolean;
/**
* Invoked to save the conference logs.
*/
- _onSaveLogs: Function,
+ _onSaveLogs: () => void;
/**
* The region reported by the participant.
*/
- _region: String,
+ _region?: string;
/**
* The video SSRC of this client.
*/
- _videoSsrc: number,
+ _videoSsrc: number;
/**
* Css class to apply on container.
*/
- className: string,
+ className: string;
/**
* The Redux dispatch function.
*/
- dispatch: Dispatch<any>,
+ dispatch: IStore['dispatch'];
/**
* Optional param for passing existing connection stats on component instantiation.
*/
- inheritedStats: Object,
-
- /**
- * Invoked to obtain translated strings.
- */
- t: Function
-};
+ inheritedStats: any;
+}
/**
* The type of the React {@code Component} state of {@link ConnectionIndicator}.
*/
-type State = AbstractState & {
+interface IState extends AbstractState {
+
+ autoHideTimeout?: number;
/**
* Whether or not the popover content should display additional statistics.
*/
- showMoreStats: boolean
-};
+ showMoreStats: boolean;
+}
/**
* Implements a React {@link Component} which displays the current connection
@@ -144,14 +150,14 @@ type State = AbstractState & {
*
* @augments {Component}
*/
-class ConnectionIndicatorContent extends AbstractConnectionIndicator<Props, State> {
+class ConnectionIndicatorContent extends AbstractConnectionIndicator<IProps, IState> {
/**
* Initializes a new {@code ConnectionIndicator} instance.
*
* @param {Object} props - The read-only properties with which the new
* instance is to be initialized.
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this.state = {
@@ -205,7 +211,7 @@ class ConnectionIndicatorContent extends AbstractConnectionIndicator<Props, Stat
onShowMore = { this._onToggleShowMore }
packetLoss = { packetLoss }
participantId = { this.props.participantId }
- region = { this.props._region }
+ region = { this.props._region ?? '' }
resolution = { resolution }
serverRegion = { serverRegion }
shouldShowMore = { this.state.showMoreStats }
@@ -264,13 +270,10 @@ class ConnectionIndicatorContent extends AbstractConnectionIndicator<Props, Stat
* @private
* @returns {Object}
*/
- _getDisplayConfiguration(percent: number): Object {
- return QUALITY_TO_WIDTH.find(x => percent >= x.percent) || {};
+ _getDisplayConfiguration(percent: number) {
+ return QUALITY_TO_WIDTH.find(x => percent >= x.percent) || { tip: '' };
}
-
- _onToggleShowMore: () => void;
-
/**
* Callback to invoke when the show more link in the popover content is
* clicked. Sets the state which will determine if the popover should show
@@ -292,7 +295,7 @@ class ConnectionIndicatorContent extends AbstractConnectionIndicator<Props, Stat
* }}
* @private
*/
-export function _mapDispatchToProps(dispatch: Dispatch<any>) {
+export function _mapDispatchToProps(dispatch: IStore['dispatch']) {
return {
/**
* Saves the conference logs.
@@ -310,10 +313,10 @@ export function _mapDispatchToProps(dispatch: Dispatch<any>) {
* Maps part of the Redux state to the props of this component.
*
* @param {Object} state - The Redux state.
- * @param {Props} ownProps - The own props of the component.
- * @returns {Props}
+ * @param {IProps} ownProps - The own props of the component.
+ * @returns {IProps}
*/
-export function _mapStateToProps(state: Object, ownProps: Props) {
+export function _mapStateToProps(state: IReduxState, ownProps: any) {
const { participantId } = ownProps;
const conference = state['features/base/conference'].conference;
const participant
@@ -324,7 +327,7 @@ export function _mapStateToProps(state: Object, ownProps: Props) {
let videoTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, participantId);
if (isScreenShareParticipant(participant)) {
- videoTrack = getVirtualScreenshareParticipantTrack(tracks, participant?.id);
+ videoTrack = getVirtualScreenshareParticipantTrack(tracks, participant?.id ?? '');
}
const _isConnectionStatusInactive = isTrackStreamingStatusInactive(videoTrack);
@@ -332,14 +335,14 @@ export function _mapStateToProps(state: Object, ownProps: Props) {
return {
_audioSsrc: audioTrack ? conference?.getSsrcByTrack(audioTrack.jitsiTrack) : undefined,
- _enableSaveLogs: state['features/base/config'].enableSaveLogs,
- _disableShowMoreStats: state['features/base/config'].disableShowMoreStats,
+ _enableSaveLogs: Boolean(state['features/base/config'].enableSaveLogs),
+ _disableShowMoreStats: Boolean(state['features/base/config'].disableShowMoreStats),
_isConnectionStatusInactive,
_isConnectionStatusInterrupted,
- _isE2EEVerified: participant?.e2eeVerified,
+ _isE2EEVerified: Boolean(participant?.e2eeVerified),
_isNarrowLayout: isNarrowLayout,
_isVirtualScreenshareParticipant: isScreenShareParticipant(participant),
- _isLocalVideo: participant?.local,
+ _isLocalVideo: Boolean(participant?.local),
_region: participant?.region,
_videoSsrc: videoTrack ? conference?.getSsrcByTrack(videoTrack.jitsiTrack) : undefined
};
diff --git a/react/features/embed-meeting/components/EmbedMeetingButton.js b/react/features/embed-meeting/components/EmbedMeetingButton.ts
similarity index 55%
rename from react/features/embed-meeting/components/EmbedMeetingButton.js
rename to react/features/embed-meeting/components/EmbedMeetingButton.ts
index a2fa9c851d..70c6942103 100644
--- a/react/features/embed-meeting/components/EmbedMeetingButton.js
+++ b/react/features/embed-meeting/components/EmbedMeetingButton.ts
@@ -1,30 +1,18 @@
-// @flow
-
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../analytics';
-import { openDialog } from '../../base/dialog';
-import { translate } from '../../base/i18n';
-import { IconCode } from '../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
+import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
+import { openDialog } from '../../base/dialog/actions';
+import { translate } from '../../base/i18n/functions';
+import { IconCode } from '../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
import EmbedMeetingDialog from './EmbedMeetingDialog';
-/**
- * The type of the React {@code Component} props of {@link EmbedMeetingButton}.
- */
-type Props = AbstractButtonProps & {
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
-};
-
/**
* Implementation of a button for opening embed meeting dialog.
*/
-class EmbedMeetingButton extends AbstractButton<Props, *> {
+class EmbedMeetingButton extends AbstractButton<AbstractButtonProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.embedMeeting';
icon = IconCode;
label = 'toolbar.embedMeeting';
diff --git a/react/features/etherpad/components/SharedDocumentButton.web.js b/react/features/etherpad/components/SharedDocumentButton.web.ts
similarity index 73%
rename from react/features/etherpad/components/SharedDocumentButton.web.js
rename to react/features/etherpad/components/SharedDocumentButton.web.ts
index ff200526a8..0419674b16 100644
--- a/react/features/etherpad/components/SharedDocumentButton.web.js
+++ b/react/features/etherpad/components/SharedDocumentButton.web.ts
@@ -1,32 +1,26 @@
-// @flow
-
import { connect } from 'react-redux';
-import type { Dispatch } from 'redux';
-import { createToolbarEvent, sendAnalytics } from '../../analytics';
-import { translate } from '../../base/i18n';
-import { IconShareDoc } from '../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
-import { toggleDocument } from '../../etherpad/actions';
+import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
+import { IReduxState } from '../../app/types';
+import { translate } from '../../base/i18n/functions';
+import { IconShareDoc } from '../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
import { setOverflowMenuVisible } from '../../toolbox/actions.web';
+import { toggleDocument } from '../actions';
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether the shared document is being edited or not.
*/
- _editing: boolean,
-
- /**
- * Redux dispatch function.
- */
- dispatch: Dispatch<any>,
-};
+ _editing: boolean;
+}
/**
* Implements an {@link AbstractButton} to open the chat screen on mobile.
*/
-class SharedDocumentButton extends AbstractButton<Props, *> {
+class SharedDocumentButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.documentOpen';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.documentClose';
icon = IconShareDoc;
@@ -74,7 +68,7 @@ class SharedDocumentButton extends AbstractButton<Props, *> {
* instance.
* @returns {Object}
*/
-function _mapStateToProps(state: Object, ownProps: Object) {
+function _mapStateToProps(state: IReduxState, ownProps: any) {
const { documentUrl, editing } = state['features/etherpad'];
const { visible = Boolean(documentUrl) } = ownProps;
diff --git a/react/features/feedback/actions.ts b/react/features/feedback/actions.ts
index 0965fc3ae0..e684fadf4f 100644
--- a/react/features/feedback/actions.ts
+++ b/react/features/feedback/actions.ts
@@ -104,7 +104,7 @@ export function maybeOpenFeedbackDialog(conference: IJitsiConference) {
* is closed.
* @returns {Object}
*/
-export function openFeedbackDialog(conference: Object, onClose?: Function) {
+export function openFeedbackDialog(conference?: IJitsiConference, onClose?: Function) {
return openDialog(FeedbackDialog, {
conference,
onClose
diff --git a/react/features/feedback/components/FeedbackButton.web.js b/react/features/feedback/components/FeedbackButton.web.ts
similarity index 59%
rename from react/features/feedback/components/FeedbackButton.web.js
rename to react/features/feedback/components/FeedbackButton.web.ts
index 987f317fd7..832da5b968 100644
--- a/react/features/feedback/components/FeedbackButton.web.js
+++ b/react/features/feedback/components/FeedbackButton.web.ts
@@ -1,34 +1,30 @@
-// @flow
-
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../analytics';
-import { translate } from '../../base/i18n';
-import { IconFeedback } from '../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
+import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
+import { IReduxState } from '../../app/types';
+import { IJitsiConference } from '../../base/conference/reducer';
+import { translate } from '../../base/i18n/functions';
+import { IconFeedback } from '../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
import { openFeedbackDialog } from '../actions';
/**
* The type of the React {@code Component} props of {@link FeedbackButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* The {@code JitsiConference} for the current conference.
*/
- _conference: Object,
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
-};
+ _conference?: IJitsiConference;
+}
/**
* Implementation of a button for opening feedback dialog.
*/
-class FeedbackButton extends AbstractButton<Props, *> {
+class FeedbackButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.feedback';
icon = IconFeedback;
label = 'toolbar.feedback';
@@ -48,7 +44,7 @@ class FeedbackButton extends AbstractButton<Props, *> {
}
}
-const mapStateToProps = state => {
+const mapStateToProps = (state: IReduxState) => {
return {
_conference: state['features/base/conference'].conference
};
diff --git a/react/features/invite/components/add-people-dialog/web/InviteButton.js b/react/features/invite/components/add-people-dialog/web/InviteButton.ts
similarity index 55%
rename from react/features/invite/components/add-people-dialog/web/InviteButton.js
rename to react/features/invite/components/add-people-dialog/web/InviteButton.ts
index 444c4b402e..842b302e2b 100644
--- a/react/features/invite/components/add-people-dialog/web/InviteButton.js
+++ b/react/features/invite/components/add-people-dialog/web/InviteButton.ts
@@ -1,28 +1,16 @@
-// @flow
-
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../../../analytics';
-import { translate } from '../../../../base/i18n';
-import { IconAddUser } from '../../../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../../../base/toolbox/components';
+import { createToolbarEvent } from '../../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../../analytics/functions';
+import { translate } from '../../../../base/i18n/functions';
+import { IconAddUser } from '../../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../../base/toolbox/components/AbstractButton';
import { beginAddPeople } from '../../../actions.any';
-/**
- * The type of the React {@code Component} props of {@link EmbedMeetingButton}.
- */
-type Props = AbstractButtonProps & {
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
-};
-
/**
* Implementation of a button for opening invite people dialog.
*/
-class InviteButton extends AbstractButton<Props, *> {
+class InviteButton extends AbstractButton<AbstractButtonProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.invite';
icon = IconAddUser;
label = 'toolbar.invite';
diff --git a/react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.js b/react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.ts
similarity index 58%
rename from react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.js
rename to react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.ts
index 66aceadbce..19b67ebcd0 100644
--- a/react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.js
+++ b/react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.ts
@@ -1,29 +1,17 @@
-// @flow
-
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../../analytics';
-import { translate } from '../../../base/i18n';
-import { IconShortcuts } from '../../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
+import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
+import { translate } from '../../../base/i18n/functions';
+import { IconShortcuts } from '../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { openSettingsDialog } from '../../../settings/actions';
import { SETTINGS_TABS } from '../../../settings/constants';
-/**
- * The type of the React {@code Component} props of {@link KeyboardShortcutsButton}.
- */
-type Props = AbstractButtonProps & {
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
-};
-
/**
* Implementation of a button for opening keyboard shortcuts dialog.
*/
-class KeyboardShortcutsButton extends AbstractButton<Props, *> {
+class KeyboardShortcutsButton extends AbstractButton<AbstractButtonProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.shortcuts';
icon = IconShortcuts;
label = 'toolbar.shortcuts';
diff --git a/react/features/participants-pane/components/web/ParticipantsPaneButton.js b/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx
similarity index 75%
rename from react/features/participants-pane/components/web/ParticipantsPaneButton.js
rename to react/features/participants-pane/components/web/ParticipantsPaneButton.tsx
index 2fdc6eb0d8..c7b318deb5 100644
--- a/react/features/participants-pane/components/web/ParticipantsPaneButton.js
+++ b/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx
@@ -1,28 +1,28 @@
-// @flow
import React from 'react';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconUsers } from '../../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
+import { IReduxState } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { IconUsers } from '../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import ParticipantsCounter from './ParticipantsCounter';
/**
* The type of the React {@code Component} props of {@link ParticipantsPaneButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether or not the participants pane is open.
*/
- _isOpen: boolean,
-};
+ _isOpen: boolean;
+}
/**
* Implementation of a button for accessing participants pane.
*/
-class ParticipantsPaneButton extends AbstractButton<Props, *> {
+class ParticipantsPaneButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.participants';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeParticipantsPane';
icon = IconUsers;
@@ -48,7 +48,7 @@ class ParticipantsPaneButton extends AbstractButton<Props, *> {
* @protected
* @returns {React$Node}
*/
- render(): React$Node {
+ render() {
return (
<div
className = 'toolbar-button-with-badge'>
@@ -63,9 +63,9 @@ class ParticipantsPaneButton extends AbstractButton<Props, *> {
* Maps part of the Redux state to the props of this component.
*
* @param {Object} state - The Redux state.
- * @returns {Props}
+ * @returns {IProps}
*/
-function mapStateToProps(state) {
+function mapStateToProps(state: IReduxState) {
const { isOpen } = state['features/participants-pane'];
return {
diff --git a/react/features/recording/components/LiveStream/web/LiveStreamButton.js b/react/features/recording/components/LiveStream/web/LiveStreamButton.ts
similarity index 74%
rename from react/features/recording/components/LiveStream/web/LiveStreamButton.js
rename to react/features/recording/components/LiveStream/web/LiveStreamButton.ts
index 53bce8dd50..aed727063a 100644
--- a/react/features/recording/components/LiveStream/web/LiveStreamButton.js
+++ b/react/features/recording/components/LiveStream/web/LiveStreamButton.ts
@@ -1,25 +1,26 @@
-// @flow
-
import { connect } from 'react-redux';
-import { getToolbarButtons } from '../../../../base/config';
-import { openDialog } from '../../../../base/dialog';
-import { translate } from '../../../../base/i18n';
+import { IReduxState } from '../../../../app/types';
+import { getToolbarButtons } from '../../../../base/config/functions.web';
+import { openDialog } from '../../../../base/dialog/actions';
+import { translate } from '../../../../base/i18n/functions';
import AbstractLiveStreamButton, {
- type Props,
+ IProps,
_mapStateToProps as _abstractMapStateToProps
} from '../AbstractLiveStreamButton';
import {
StartLiveStreamDialog,
StopLiveStreamDialog
+
+ // @ts-ignore
} from './index';
/**
* Button for opening the live stream settings dialog.
*/
-class LiveStreamButton extends AbstractLiveStreamButton<Props> {
+class LiveStreamButton extends AbstractLiveStreamButton<IProps> {
/**
* Handles clicking / pressing the button.
@@ -42,7 +43,7 @@ class LiveStreamButton extends AbstractLiveStreamButton<Props> {
* {@code LiveStreamButton} component.
*
* @param {Object} state - The Redux state.
- * @param {Props} ownProps - The own props of the Component.
+ * @param {IProps} ownProps - The own props of the Component.
* @private
* @returns {{
* _conference: Object,
@@ -51,7 +52,7 @@ class LiveStreamButton extends AbstractLiveStreamButton<Props> {
* visible: boolean
* }}
*/
-function _mapStateToProps(state: Object, ownProps: Props) {
+function _mapStateToProps(state: IReduxState, ownProps: any) {
const abstractProps = _abstractMapStateToProps(state, ownProps);
const toolbarButtons = getToolbarButtons(state);
let { visible } = ownProps;
diff --git a/react/features/recording/components/Recording/web/RecordButton.js b/react/features/recording/components/Recording/web/RecordButton.ts
similarity index 73%
rename from react/features/recording/components/Recording/web/RecordButton.js
rename to react/features/recording/components/Recording/web/RecordButton.ts
index 9c6e938917..0590d11e81 100644
--- a/react/features/recording/components/Recording/web/RecordButton.js
+++ b/react/features/recording/components/Recording/web/RecordButton.ts
@@ -1,22 +1,22 @@
-// @flow
-
import { connect } from 'react-redux';
-import { getToolbarButtons } from '../../../../base/config';
-import { openDialog } from '../../../../base/dialog';
-import { translate } from '../../../../base/i18n';
+import { IReduxState } from '../../../../app/types';
+import { getToolbarButtons } from '../../../../base/config/functions.web';
+import { openDialog } from '../../../../base/dialog/actions';
+import { translate } from '../../../../base/i18n/functions';
import AbstractRecordButton, {
- type Props,
+ IProps,
_mapStateToProps as _abstractMapStateToProps
} from '../AbstractRecordButton';
+// @ts-ignore
import { StartRecordingDialog, StopRecordingDialog } from './index';
/**
* Button for opening a dialog where a recording session can be started.
*/
-class RecordingButton extends AbstractRecordButton<Props> {
+class RecordingButton extends AbstractRecordButton<IProps> {
/**
* Handles clicking / pressing the button.
@@ -39,7 +39,6 @@ class RecordingButton extends AbstractRecordButton<Props> {
* {@code RecordButton} component.
*
* @param {Object} state - The Redux state.
- * @param {Props} ownProps - The own props of the Component.
* @private
* @returns {{
* _fileRecordingsDisabledTooltipKey: ?string,
@@ -48,8 +47,8 @@ class RecordingButton extends AbstractRecordButton<Props> {
* visible: boolean
* }}
*/
-export function _mapStateToProps(state: Object, ownProps: Props) {
- const abstractProps = _abstractMapStateToProps(state, ownProps);
+export function _mapStateToProps(state: IReduxState) {
+ const abstractProps = _abstractMapStateToProps(state);
const toolbarButtons = getToolbarButtons(state);
const visible = toolbarButtons.includes('recording') && abstractProps.visible;
diff --git a/react/features/screen-share/components/web/ShareAudioButton.js b/react/features/screen-share/components/web/ShareAudioButton.ts
similarity index 69%
rename from react/features/screen-share/components/web/ShareAudioButton.js
rename to react/features/screen-share/components/web/ShareAudioButton.ts
index b31db794f1..25256f05b3 100644
--- a/react/features/screen-share/components/web/ShareAudioButton.js
+++ b/react/features/screen-share/components/web/ShareAudioButton.ts
@@ -1,38 +1,25 @@
-// @flow
-
import { connect } from 'react-redux';
-import type { Dispatch } from 'redux';
-import { translate } from '../../../base/i18n';
-import {
- IconVolumeOff,
- IconVolumeUp
-} from '../../../base/icons';
-import {
- AbstractButton,
- type AbstractButtonProps
-} from '../../../base/toolbox/components';
+import { IReduxState } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { IconVolumeOff, IconVolumeUp } from '../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { setOverflowMenuVisible } from '../../../toolbox/actions.web';
import { startAudioScreenShareFlow } from '../../actions.web';
import { isAudioOnlySharing } from '../../functions';
-type Props = AbstractButtonProps & {
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Dispatch<any>,
+interface IProps extends AbstractButtonProps {
/**
* Whether or not the local participant is audio only screen sharing.
*/
- _isAudioOnlySharing: boolean
+ _isAudioOnlySharing: boolean;
}
/**
* Component that renders a toolbar button for toggling audio only screen share.
*/
-class ShareAudioButton extends AbstractButton<Props, *> {
+class ShareAudioButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.shareaudio';
icon = IconVolumeUp;
label = 'toolbar.shareaudio';
@@ -70,12 +57,12 @@ class ShareAudioButton extends AbstractButton<Props, *> {
*
* @param {Object} state - The Redux state.
* @private
- * @returns {Props}
+ * @returns {IProps}
*/
-function _mapStateToProps(state: Object) {
+function _mapStateToProps(state: IReduxState) {
return {
- _isAudioOnlySharing: isAudioOnlySharing(state)
+ _isAudioOnlySharing: Boolean(isAudioOnlySharing(state))
};
}
diff --git a/react/features/security/components/security-dialog/AbstractSecurityDialogButton.ts b/react/features/security/components/security-dialog/AbstractSecurityDialogButton.ts
index f252aa29b9..cfaa8e2b1b 100644
--- a/react/features/security/components/security-dialog/AbstractSecurityDialogButton.ts
+++ b/react/features/security/components/security-dialog/AbstractSecurityDialogButton.ts
@@ -81,7 +81,7 @@ export function _mapStateToProps(state: IReduxState) {
const enabledMeetingPassFlag = getFeatureFlag(state, MEETING_PASSWORD_ENABLED, true);
return {
- _locked: locked || lobbyEnabled,
+ _locked: Boolean(locked || lobbyEnabled),
visible: enabledFlag && (enabledLobbyModeFlag || enabledMeetingPassFlag)
};
}
diff --git a/react/features/security/components/security-dialog/web/SecurityDialogButton.js b/react/features/security/components/security-dialog/web/SecurityDialogButton.ts
similarity index 77%
rename from react/features/security/components/security-dialog/web/SecurityDialogButton.js
rename to react/features/security/components/security-dialog/web/SecurityDialogButton.ts
index be3206a816..076f92d433 100644
--- a/react/features/security/components/security-dialog/web/SecurityDialogButton.js
+++ b/react/features/security/components/security-dialog/web/SecurityDialogButton.ts
@@ -1,11 +1,9 @@
-// @flow
-
import { connect } from 'react-redux';
-import { translate } from '../../../../base/i18n';
+import { translate } from '../../../../base/i18n/functions';
import { toggleSecurityDialog } from '../../../actions';
import AbstractSecurityDialogButton, {
- type Props as AbstractSecurityDialogButtonProps,
+ IProps as AbstractSecurityDialogButtonProps,
_mapStateToProps as _abstractMapStateToProps
} from '../AbstractSecurityDialogButton';
@@ -14,7 +12,7 @@ type Props = AbstractSecurityDialogButtonProps;
/**
* Implements an {@link AbstractSecurityDialogButton} to open the security dialog.
*/
-class SecurityDialogButton<P: Props, S:*> extends AbstractSecurityDialogButton<P, S> {
+class SecurityDialogButton<P extends Props, S> extends AbstractSecurityDialogButton<P, S> {
/**
* Opens / closes the security dialog.
diff --git a/react/features/settings/components/web/SettingsButton.js b/react/features/settings/components/web/SettingsButton.ts
similarity index 68%
rename from react/features/settings/components/web/SettingsButton.js
rename to react/features/settings/components/web/SettingsButton.ts
index c7dd6e8b20..c9dc5fb078 100644
--- a/react/features/settings/components/web/SettingsButton.js
+++ b/react/features/settings/components/web/SettingsButton.ts
@@ -1,40 +1,34 @@
-// @flow
-
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../../analytics';
-import { translate } from '../../../base/i18n';
-import { IconGear } from '../../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
+import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
+import { translate } from '../../../base/i18n/functions';
+import { IconGear } from '../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { openSettingsDialog } from '../../actions';
import { SETTINGS_TABS } from '../../constants';
/**
* The type of the React {@code Component} props of {@link SettingsButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* The default tab at which the settings dialog will be opened.
*/
- defaultTab: string,
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function,
+ defaultTab: string;
/**
* Indicates whether the device selection dialog is displayed on the
* welcome page or not.
*/
- isDisplayedOnWelcomePage: boolean
-};
+ isDisplayedOnWelcomePage: boolean;
+}
/**
* An abstract implementation of a button for accessing settings.
*/
-class SettingsButton extends AbstractButton<Props, *> {
+class SettingsButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.Settings';
icon = IconGear;
label = 'toolbar.Settings';
diff --git a/react/features/settings/components/web/audio/AudioSettingsPopup.tsx b/react/features/settings/components/web/audio/AudioSettingsPopup.tsx
index 8ec1931736..45a3d7d1d3 100644
--- a/react/features/settings/components/web/audio/AudioSettingsPopup.tsx
+++ b/react/features/settings/components/web/audio/AudioSettingsPopup.tsx
@@ -20,30 +20,67 @@ import {
import { toggleAudioSettings } from '../../../actions';
import { getAudioSettingsVisibility } from '../../../functions.web';
-import AudioSettingsContent, { type IProps as AudioSettingsContentProps } from './AudioSettingsContent';
+import AudioSettingsContent from './AudioSettingsContent';
-interface IProps extends AudioSettingsContentProps {
+interface IProps {
/**
* Component's children (the audio button).
*/
children: ReactNode;
+ /**
+ * The deviceId of the microphone in use.
+ */
+ currentMicDeviceId: string;
+
+ /**
+ * The deviceId of the output device in use.
+ */
+ currentOutputDeviceId?: string;
+
/**
* Flag controlling the visibility of the popup.
*/
isOpen: boolean;
+ /**
+ * Used to decide whether to measure audio levels for microphone devices.
+ */
+ measureAudioLevels: boolean;
+
+ /**
+ * A list with objects containing the labels and deviceIds
+ * of all the input devices.
+ */
+ microphoneDevices: Array<{ deviceId: string; label: string; }>;
+
/**
* Callback executed when the popup closes.
*/
onClose: Function;
+ /**
+ * A list of objects containing the labels and deviceIds
+ * of all the output devices.
+ */
+ outputDevices: Array<{ deviceId: string; label: string; }>;
+
/**
* The popup placement enum value.
*/
popupPlacement: string;
+
+ /**
+ * Used to set a new microphone as the current one.
+ */
+ setAudioInputDevice: Function;
+
+ /**
+ * Used to set a new output device as the current one.
+ */
+ setAudioOutputDevice: Function;
}
/**
diff --git a/react/features/settings/components/web/video/VideoSettingsPopup.tsx b/react/features/settings/components/web/video/VideoSettingsPopup.tsx
index 55588d1816..381ed33d74 100644
--- a/react/features/settings/components/web/video/VideoSettingsPopup.tsx
+++ b/react/features/settings/components/web/video/VideoSettingsPopup.tsx
@@ -14,16 +14,21 @@ import { getCurrentCameraDeviceId } from '../../../../base/settings/functions.we
import { toggleVideoSettings } from '../../../actions';
import { getVideoSettingsVisibility } from '../../../functions.web';
-import VideoSettingsContent, { type IProps as VideoSettingsProps } from './VideoSettingsContent';
+import VideoSettingsContent from './VideoSettingsContent';
-interface IProps extends VideoSettingsProps {
+interface IProps {
/**
* Component children (the Video button).
*/
children: ReactNode;
+ /**
+ * The deviceId of the camera device currently being used.
+ */
+ currentCameraDeviceId: string;
+
/**
* Flag controlling the visibility of the popup.
*/
@@ -38,6 +43,16 @@ interface IProps extends VideoSettingsProps {
* The popup placement enum value.
*/
popupPlacement: string;
+
+ /**
+ * Callback invoked to change current camera.
+ */
+ setVideoInputDevice: Function;
+
+ /**
+ * All the camera device ids currently connected.
+ */
+ videoDeviceIds: string[];
}
/**
diff --git a/react/features/shared-video/components/web/SharedVideoButton.js b/react/features/shared-video/components/web/SharedVideoButton.ts
similarity index 74%
rename from react/features/shared-video/components/web/SharedVideoButton.js
rename to react/features/shared-video/components/web/SharedVideoButton.ts
index 38b3fb1d6f..f1d6240bc7 100644
--- a/react/features/shared-video/components/web/SharedVideoButton.js
+++ b/react/features/shared-video/components/web/SharedVideoButton.ts
@@ -1,39 +1,29 @@
-// @flow
-
import { connect } from 'react-redux';
-import type { Dispatch } from 'redux';
-import { translate } from '../../../base/i18n';
-import { IconPlay } from '../../../base/icons';
-import {
- AbstractButton,
- type AbstractButtonProps
-} from '../../../base/toolbox/components';
+import { IReduxState } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { IconPlay } from '../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { toggleSharedVideo } from '../../actions.any';
import { isSharingStatus } from '../../functions';
-type Props = AbstractButtonProps & {
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Dispatch<any>,
+interface IProps extends AbstractButtonProps {
/**
* Whether or not the button is disabled.
*/
- _isDisabled: boolean,
+ _isDisabled: boolean;
/**
* Whether or not the local participant is sharing a video.
*/
- _sharingVideo: boolean
-};
+ _sharingVideo: boolean;
+}
/**
* Implements an {@link AbstractButton} to open the user documentation in a new window.
*/
-class SharedVideoButton extends AbstractButton<Props, *> {
+class SharedVideoButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.sharedvideo';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.stopSharedVideo';
icon = IconPlay;
@@ -90,17 +80,17 @@ class SharedVideoButton extends AbstractButton<Props, *> {
*
* @param {Object} state - The Redux state.
* @private
- * @returns {Props}
+ * @returns {IProps}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
const {
disabled: sharedVideoBtnDisabled,
status: sharedVideoStatus
} = state['features/shared-video'];
return {
- _isDisabled: sharedVideoBtnDisabled,
- _sharingVideo: isSharingStatus(sharedVideoStatus)
+ _isDisabled: Boolean(sharedVideoBtnDisabled),
+ _sharingVideo: isSharingStatus(sharedVideoStatus ?? '')
};
}
diff --git a/react/features/subtitles/components/AbstractClosedCaptionButton.ts b/react/features/subtitles/components/AbstractClosedCaptionButton.ts
index aca82e8339..26d541d461 100644
--- a/react/features/subtitles/components/AbstractClosedCaptionButton.ts
+++ b/react/features/subtitles/components/AbstractClosedCaptionButton.ts
@@ -8,6 +8,8 @@ import { maybeShowPremiumFeatureDialog } from '../../jaas/actions';
export interface IAbstractProps extends AbstractButtonProps {
+ _language: string;
+
/**
* Whether the local participant is currently requesting subtitles.
*/
@@ -17,6 +19,10 @@ export interface IAbstractProps extends AbstractButtonProps {
* Selected language for subtitle.
*/
_subtitles: string;
+
+ languages?: string;
+
+ languagesHead?: string;
}
/**
diff --git a/react/features/subtitles/components/ClosedCaptionButton.web.js b/react/features/subtitles/components/ClosedCaptionButton.web.ts
similarity index 73%
rename from react/features/subtitles/components/ClosedCaptionButton.web.js
rename to react/features/subtitles/components/ClosedCaptionButton.web.ts
index e22f70e000..7e27ec9cc4 100644
--- a/react/features/subtitles/components/ClosedCaptionButton.web.js
+++ b/react/features/subtitles/components/ClosedCaptionButton.web.ts
@@ -1,10 +1,8 @@
-// @flow
-
import { connect } from 'react-redux';
-import { translate } from '../../base/i18n';
-import { IconSubtitles } from '../../base/icons';
-import { toggleLanguageSelectorDialog } from '../actions';
+import { translate } from '../../base/i18n/functions';
+import { IconSubtitles } from '../../base/icons/svg';
+import { toggleLanguageSelectorDialog } from '../actions.web';
import {
AbstractClosedCaptionButton,
@@ -22,8 +20,8 @@ class ClosedCaptionButton
label = 'toolbar.startSubtitles';
labelProps = {
language: this.props.t(this.props._language),
- languages: this.props.t(this.props.languages),
- languagesHead: this.props.t(this.props.languagesHead)
+ languages: this.props.t(this.props.languages ?? ''),
+ languagesHead: this.props.t(this.props.languagesHead ?? '')
};
/**
diff --git a/react/features/toolbox/actions.native.ts b/react/features/toolbox/actions.native.ts
index 8fbcf6d6a3..7f84c5637f 100644
--- a/react/features/toolbox/actions.native.ts
+++ b/react/features/toolbox/actions.native.ts
@@ -9,3 +9,16 @@ export * from './actions.any';
export function showToolbox(_timeout?: number): any {
return {};
}
+
+/**
+ * Shows/hides the overflow menu.
+ *
+ * @param {boolean} _visible - True to show it or false to hide it.
+ * @returns {{
+ * type: SET_OVERFLOW_MENU_VISIBLE,
+ * visible: boolean
+ * }}
+ */
+export function setOverflowMenuVisible(_visible: boolean): any {
+ return {};
+}
diff --git a/react/features/toolbox/components/AudioMuteButton.js b/react/features/toolbox/components/AudioMuteButton.ts
similarity index 77%
rename from react/features/toolbox/components/AudioMuteButton.js
rename to react/features/toolbox/components/AudioMuteButton.ts
index 1cc96ea0be..9ad5b5db25 100644
--- a/react/features/toolbox/components/AudioMuteButton.js
+++ b/react/features/toolbox/components/AudioMuteButton.ts
@@ -1,43 +1,32 @@
-// @flow
-
import { connect } from 'react-redux';
-import {
- ACTION_SHORTCUT_TRIGGERED,
- AUDIO_MUTE,
- createShortcutEvent,
- sendAnalytics
-} from '../../analytics';
-import { AUDIO_MUTE_BUTTON_ENABLED, getFeatureFlag } from '../../base/flags';
-import { translate } from '../../base/i18n';
-import { MEDIA_TYPE } from '../../base/media';
-import { AbstractAudioMuteButton, AbstractButton } from '../../base/toolbox/components';
-import type { AbstractButtonProps } from '../../base/toolbox/components';
-import { isLocalTrackMuted } from '../../base/tracks';
+import { ACTION_SHORTCUT_TRIGGERED, AUDIO_MUTE, createShortcutEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
+import { IReduxState } from '../../app/types';
+import { AUDIO_MUTE_BUTTON_ENABLED } from '../../base/flags/constants';
+import { getFeatureFlag } from '../../base/flags/functions';
+import { translate } from '../../base/i18n/functions';
+import { MEDIA_TYPE } from '../../base/media/constants';
+import AbstractAudioMuteButton from '../../base/toolbox/components/AbstractAudioMuteButton';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
+import { isLocalTrackMuted } from '../../base/tracks/functions';
import { muteLocal } from '../../video-menu/actions';
import { isAudioMuteButtonDisabled } from '../functions';
-declare var APP: Object;
-
/**
* The type of the React {@code Component} props of {@link AudioMuteButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether audio is currently muted or not.
*/
- _audioMuted: boolean,
+ _audioMuted: boolean;
/**
* Whether the button is disabled.
*/
- _disabled: boolean,
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
+ _disabled: boolean;
}
/**
@@ -45,7 +34,7 @@ type Props = AbstractButtonProps & {
*
* @augments AbstractAudioMuteButton
*/
-class AudioMuteButton extends AbstractAudioMuteButton<Props, *> {
+class AudioMuteButton extends AbstractAudioMuteButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.mute';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.unmute';
label = 'toolbar.mute';
@@ -55,10 +44,10 @@ class AudioMuteButton extends AbstractAudioMuteButton<Props, *> {
/**
* Initializes a new {@code AudioMuteButton} instance.
*
- * @param {Props} props - The read-only React {@code Component} props with
+ * @param {IProps} props - The read-only React {@code Component} props with
* which the new instance is to be initialized.
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
// Bind event handlers so they are only bound once per instance.
@@ -102,8 +91,6 @@ class AudioMuteButton extends AbstractAudioMuteButton<Props, *> {
return this.props._audioMuted;
}
- _onKeyboardShortcut: () => void;
-
/**
* Creates an analytics keyboard shortcut event and dispatches an action to
* toggle the audio muting.
@@ -158,7 +145,7 @@ class AudioMuteButton extends AbstractAudioMuteButton<Props, *> {
* _disabled: boolean
* }}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
const _audioMuted = isLocalTrackMuted(state['features/base/tracks'], MEDIA_TYPE.AUDIO);
const _disabled = isAudioMuteButtonDisabled(state);
const enabledFlag = getFeatureFlag(state, AUDIO_MUTE_BUTTON_ENABLED, true);
diff --git a/react/features/toolbox/components/DownloadButton.js b/react/features/toolbox/components/DownloadButton.ts
similarity index 61%
rename from react/features/toolbox/components/DownloadButton.js
rename to react/features/toolbox/components/DownloadButton.ts
index bdd49728eb..67eec70976 100644
--- a/react/features/toolbox/components/DownloadButton.js
+++ b/react/features/toolbox/components/DownloadButton.ts
@@ -1,25 +1,25 @@
-// @flow
-
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../analytics';
-import { translate } from '../../base/i18n';
-import { IconDownload } from '../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
-import { openURLInBrowser } from '../../base/util';
+import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
+import { IReduxState } from '../../app/types';
+import { translate } from '../../base/i18n/functions';
+import { IconDownload } from '../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
+import { openURLInBrowser } from '../../base/util/openURLInBrowser';
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* The URL to the applications page.
*/
- _downloadAppsUrl: string
-};
+ _downloadAppsUrl: string;
+}
/**
* Implements an {@link AbstractButton} to open the applications page in a new window.
*/
-class DownloadButton extends AbstractButton<Props, *> {
+class DownloadButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.download';
icon = IconDownload;
label = 'toolbar.download';
@@ -46,12 +46,12 @@ class DownloadButton extends AbstractButton<Props, *> {
* @param {Object} state - The redux store/state.
* @returns {Object}
*/
-function _mapStateToProps(state: Object) {
+function _mapStateToProps(state: IReduxState) {
const { downloadAppsUrl } = state['features/base/config'].deploymentUrls || {};
const visible = typeof downloadAppsUrl === 'string';
return {
- _downloadAppsUrl: downloadAppsUrl,
+ _downloadAppsUrl: downloadAppsUrl ?? '',
visible
};
}
diff --git a/react/features/toolbox/components/HangupButton.js b/react/features/toolbox/components/HangupButton.ts
similarity index 64%
rename from react/features/toolbox/components/HangupButton.js
rename to react/features/toolbox/components/HangupButton.ts
index a5a94db0d9..db0c09f9a6 100644
--- a/react/features/toolbox/components/HangupButton.js
+++ b/react/features/toolbox/components/HangupButton.ts
@@ -1,31 +1,19 @@
-// @flow
-
import _ from 'lodash';
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../analytics';
+import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
import { leaveConference } from '../../base/conference/actions';
-import { translate } from '../../base/i18n';
-import { AbstractHangupButton } from '../../base/toolbox/components';
-import type { AbstractButtonProps } from '../../base/toolbox/components';
-
-/**
- * The type of the React {@code Component} props of {@link HangupButton}.
- */
-type Props = AbstractButtonProps & {
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
-};
+import { translate } from '../../base/i18n/functions';
+import { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
+import AbstractHangupButton from '../../base/toolbox/components/AbstractHangupButton';
/**
* Component that renders a toolbar button for leaving the current conference.
*
* @augments AbstractHangupButton
*/
-class HangupButton extends AbstractHangupButton<Props, *> {
+class HangupButton extends AbstractHangupButton<AbstractButtonProps> {
_hangup: Function;
accessibilityLabel = 'toolbar.accessibilityLabel.hangup';
@@ -38,7 +26,7 @@ class HangupButton extends AbstractHangupButton<Props, *> {
* @param {Props} props - The read-only properties with which the new
* instance is to be initialized.
*/
- constructor(props: Props) {
+ constructor(props: AbstractButtonProps) {
super(props);
this._hangup = _.once(() => {
diff --git a/react/features/toolbox/components/HelpButton.js b/react/features/toolbox/components/HelpButton.ts
similarity index 58%
rename from react/features/toolbox/components/HelpButton.js
rename to react/features/toolbox/components/HelpButton.ts
index 232b1ec2bc..0a60901df4 100644
--- a/react/features/toolbox/components/HelpButton.js
+++ b/react/features/toolbox/components/HelpButton.ts
@@ -1,26 +1,27 @@
-// @flow
-
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../analytics';
-import { HELP_BUTTON_ENABLED, getFeatureFlag } from '../../base/flags';
-import { translate } from '../../base/i18n';
-import { IconHelp } from '../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
-import { openURLInBrowser } from '../../base/util';
+import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
+import { IReduxState } from '../../app/types';
+import { HELP_BUTTON_ENABLED } from '../../base/flags/constants';
+import { getFeatureFlag } from '../../base/flags/functions';
+import { translate } from '../../base/i18n/functions';
+import { IconHelp } from '../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
+import { openURLInBrowser } from '../../base/util/openURLInBrowser';
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* The URL to the user documentation.
*/
- _userDocumentationURL: string
-};
+ _userDocumentationURL: string;
+}
/**
* Implements an {@link AbstractButton} to open the user documentation in a new window.
*/
-class HelpButton extends AbstractButton<Props, *> {
+class HelpButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.help';
icon = IconHelp;
label = 'toolbar.help';
@@ -47,13 +48,13 @@ class HelpButton extends AbstractButton<Props, *> {
* @param {Object} state - The redux store/state.
* @returns {Object}
*/
-function _mapStateToProps(state: Object) {
+function _mapStateToProps(state: IReduxState) {
const { userDocumentationURL } = state['features/base/config'].deploymentUrls || {};
const enabled = getFeatureFlag(state, HELP_BUTTON_ENABLED, true);
const visible = typeof userDocumentationURL === 'string' && enabled;
return {
- _userDocumentationURL: userDocumentationURL,
+ _userDocumentationURL: userDocumentationURL ?? '',
visible
};
}
diff --git a/react/features/toolbox/components/VideoMuteButton.js b/react/features/toolbox/components/VideoMuteButton.ts
similarity index 77%
rename from react/features/toolbox/components/VideoMuteButton.js
rename to react/features/toolbox/components/VideoMuteButton.ts
index 3a00e64a70..d8efdbca81 100644
--- a/react/features/toolbox/components/VideoMuteButton.js
+++ b/react/features/toolbox/components/VideoMuteButton.ts
@@ -1,44 +1,33 @@
-// @flow
-
import { connect } from 'react-redux';
-import {
- ACTION_SHORTCUT_TRIGGERED,
- VIDEO_MUTE,
- createShortcutEvent,
- sendAnalytics
-} from '../../analytics';
-import { VIDEO_MUTE_BUTTON_ENABLED, getFeatureFlag } from '../../base/flags';
-import { translate } from '../../base/i18n';
-import { MEDIA_TYPE } from '../../base/media';
-import { AbstractButton, AbstractVideoMuteButton } from '../../base/toolbox/components';
-import type { AbstractButtonProps } from '../../base/toolbox/components';
-import { isLocalTrackMuted } from '../../base/tracks';
+import { ACTION_SHORTCUT_TRIGGERED, VIDEO_MUTE, createShortcutEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
+import { IReduxState } from '../../app/types';
+import { VIDEO_MUTE_BUTTON_ENABLED } from '../../base/flags/constants';
+import { getFeatureFlag } from '../../base/flags/functions';
+import { translate } from '../../base/i18n/functions';
+import { MEDIA_TYPE } from '../../base/media/constants';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
+import AbstractVideoMuteButton from '../../base/toolbox/components/AbstractVideoMuteButton';
+import { isLocalTrackMuted } from '../../base/tracks/functions';
import { handleToggleVideoMuted } from '../actions.any';
import { isVideoMuteButtonDisabled } from '../functions';
-declare var APP: Object;
-
/**
* The type of the React {@code Component} props of {@link VideoMuteButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
- /**
- * Whether video is currently muted or not.
- */
- _videoMuted: boolean,
-
/**
* Whether video button is disabled or not.
*/
- _videoDisabled: boolean,
+ _videoDisabled: boolean;
/**
- * The redux {@code dispatch} function.
+ * Whether video is currently muted or not.
*/
- dispatch: Function
+ _videoMuted: boolean;
}
/**
@@ -46,7 +35,7 @@ type Props = AbstractButtonProps & {
*
* @augments AbstractVideoMuteButton
*/
-class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
+class VideoMuteButton extends AbstractVideoMuteButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.videomute';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.videounmute';
label = 'toolbar.videomute';
@@ -56,10 +45,10 @@ class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
/**
* Initializes a new {@code VideoMuteButton} instance.
*
- * @param {Props} props - The read-only React {@code Component} props with
+ * @param {IProps} props - The read-only React {@code Component} props with
* which the new instance is to be initialized.
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
// Bind event handlers so they are only bound once per instance.
@@ -114,8 +103,6 @@ class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
return this.props._videoMuted;
}
- _onKeyboardShortcut: () => void;
-
/**
* Creates an analytics keyboard shortcut event and dispatches an action to
* toggle the video muting.
@@ -161,7 +148,7 @@ class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
* _videoMuted: boolean
* }}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
const tracks = state['features/base/tracks'];
const enabledFlag = getFeatureFlag(state, VIDEO_MUTE_BUTTON_ENABLED, true);
diff --git a/react/features/toolbox/components/web/AudioSettingsButton.js b/react/features/toolbox/components/web/AudioSettingsButton.tsx
similarity index 76%
rename from react/features/toolbox/components/web/AudioSettingsButton.js
rename to react/features/toolbox/components/web/AudioSettingsButton.tsx
index 89ce05ea70..f59e4e1403 100644
--- a/react/features/toolbox/components/web/AudioSettingsButton.js
+++ b/react/features/toolbox/components/web/AudioSettingsButton.tsx
@@ -1,95 +1,91 @@
-// @flow
-
import React, { Component } from 'react';
+import { WithTranslation } from 'react-i18next';
import { connect } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import { isMobileBrowser } from '../../../base/environment/utils';
-import { translate } from '../../../base/i18n';
-import { IconArrowUp } from '../../../base/icons';
+import { translate } from '../../../base/i18n/functions';
+import { IconArrowUp } from '../../../base/icons/svg';
+// eslint-disable-next-line lines-around-comment
+// @ts-ignore
import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
-import { ToolboxButtonWithIcon } from '../../../base/toolbox/components';
-import { AudioSettingsPopup, toggleAudioSettings } from '../../../settings';
+import ToolboxButtonWithIcon from '../../../base/toolbox/components/web/ToolboxButtonWithIcon';
+import { toggleAudioSettings } from '../../../settings/actions';
+import AudioSettingsPopup from '../../../settings/components/web/audio/AudioSettingsPopup';
import { getAudioSettingsVisibility } from '../../../settings/functions';
import { isAudioSettingsButtonDisabled } from '../../functions';
import AudioMuteButton from '../AudioMuteButton';
-type Props = {
+interface IProps extends WithTranslation {
/**
* The button's key.
*/
- buttonKey?: string,
+ buttonKey?: string;
/**
* External handler for click action.
*/
- handleClick: Function,
+ handleClick: Function;
/**
* Indicates whether audio permissions have been granted or denied.
*/
- hasPermissions: boolean,
+ hasPermissions: boolean;
/**
- * Click handler for the small icon. Opens audio options.
+ * If the button should be disabled.
*/
- onAudioOptionsClick: Function,
+ isDisabled: boolean;
/**
- * If the button should be disabled.
+ * Defines is popup is open.
*/
- isDisabled: boolean,
+ isOpen: boolean;
/**
* Notify mode for `toolbarButtonClicked` event -
* whether to only notify or to also prevent button click routine.
*/
- notifyMode?: string,
+ notifyMode?: string;
/**
- * Used for translation.
+ * Click handler for the small icon. Opens audio options.
*/
- t: Function,
+ onAudioOptionsClick: Function;
/**
* Flag controlling the visibility of the button.
* AudioSettings popup is disabled on mobile browsers.
*/
- visible: boolean,
-
- /**
- * Defines is popup is open.
- */
- isOpen: boolean,
-};
+ visible: boolean;
+}
/**
* Button used for audio & audio settings.
*
* @returns {ReactElement}
*/
-class AudioSettingsButton extends Component<Props> {
+class AudioSettingsButton extends Component<IProps> {
/**
* Initializes a new {@code AudioSettingsButton} instance.
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._onEscClick = this._onEscClick.bind(this);
this._onClick = this._onClick.bind(this);
}
- _onEscClick: (KeyboardEvent) => void;
-
/**
* Click handler for the more actions entries.
*
* @param {KeyboardEvent} event - Esc key click to close the popup.
* @returns {void}
*/
- _onEscClick(event) {
+ _onEscClick(event: React.KeyboardEvent) {
if (event.key === 'Escape' && this.props.isOpen) {
event.preventDefault();
event.stopPropagation();
@@ -97,8 +93,6 @@ class AudioSettingsButton extends Component<Props> {
}
}
- _onClick: () => void;
-
/**
* Click handler for the more actions entries.
*
@@ -153,14 +147,14 @@ class AudioSettingsButton extends Component<Props> {
* @param {Object} state - Redux state.
* @returns {Object}
*/
-function mapStateToProps(state) {
- const { permissions = {} } = state['features/base/devices'];
+function mapStateToProps(state: IReduxState) {
+ const { permissions = { audio: false } } = state['features/base/devices'];
const { isNarrowLayout } = state['features/base/responsive-ui'];
return {
hasPermissions: permissions.audio,
- isDisabled: isAudioSettingsButtonDisabled(state),
- isOpen: getAudioSettingsVisibility(state),
+ isDisabled: Boolean(isAudioSettingsButtonDisabled(state)),
+ isOpen: Boolean(getAudioSettingsVisibility(state)),
visible: !isMobileBrowser() && !isNarrowLayout
};
}
diff --git a/react/features/toolbox/components/web/FullscreenButton.js b/react/features/toolbox/components/web/FullscreenButton.ts
similarity index 60%
rename from react/features/toolbox/components/web/FullscreenButton.js
rename to react/features/toolbox/components/web/FullscreenButton.ts
index e179b0328f..7f3729d88b 100644
--- a/react/features/toolbox/components/web/FullscreenButton.js
+++ b/react/features/toolbox/components/web/FullscreenButton.ts
@@ -1,49 +1,30 @@
-// @flow
-
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconEnterFullscreen, IconExitFullscreen } from '../../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
+import { IReduxState } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { IconEnterFullscreen, IconExitFullscreen } from '../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether or not the app is currently in full screen.
*/
- _fullScreen: boolean,
-};
+ _fullScreen?: boolean;
+}
/**
* Implementation of a button for toggling fullscreen state.
*/
-class FullscreenButton extends AbstractButton<Props, *> {
+class FullscreenButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.enterFullScreen';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.exitFullScreen';
label = 'toolbar.enterFullScreen';
toggledLabel = 'toolbar.exitFullScreen';
tooltip = 'toolbar.enterFullScreen';
toggledTooltip = 'toolbar.exitFullScreen';
-
- /**
- * Retrieves icon dynamically.
- */
- get icon() {
- if (this._isToggled()) {
- return IconExitFullscreen;
- }
-
- return IconEnterFullscreen;
- }
-
- /**
- * Required by linter due to AbstractButton overwritten prop being writable.
- *
- * @param {string} _value - The value.
- */
- set icon(_value) {
- // Unused.
- }
+ toggledIcon = IconExitFullscreen;
+ icon = IconEnterFullscreen;
/**
* Indicates whether this button is in toggled state or not.
@@ -63,7 +44,7 @@ class FullscreenButton extends AbstractButton<Props, *> {
* @param {Object} state - Redux state.
* @returns {Object}
*/
-const mapStateToProps = state => {
+const mapStateToProps = (state: IReduxState) => {
return {
_fullScreen: state['features/toolbox'].fullScreen
};
diff --git a/react/features/toolbox/components/web/LinkToSalesforceButton.js b/react/features/toolbox/components/web/LinkToSalesforceButton.ts
similarity index 56%
rename from react/features/toolbox/components/web/LinkToSalesforceButton.js
rename to react/features/toolbox/components/web/LinkToSalesforceButton.ts
index 1d6026d695..4799131933 100644
--- a/react/features/toolbox/components/web/LinkToSalesforceButton.js
+++ b/react/features/toolbox/components/web/LinkToSalesforceButton.ts
@@ -1,29 +1,19 @@
-// @flow
-
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../../analytics';
-import { openDialog } from '../../../base/dialog';
-import { translate } from '../../../base/i18n';
-import { IconCloudUpload } from '../../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
+import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
+import { openDialog } from '../../../base/dialog/actions';
+import { translate } from '../../../base/i18n/functions';
+import { IconCloudUpload } from '../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
+// eslint-disable-next-line lines-around-comment
+// @ts-ignore
import { SalesforceLinkDialog } from '../../../salesforce/components';
-/**
- * The type of the React {@code Component} props of {@link LinkToSalesforce}.
- */
-type Props = AbstractButtonProps & {
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
-};
-
/**
* Implementation of a button for opening the Salesforce link dialog.
*/
-class LinkToSalesforce extends AbstractButton<Props, *> {
+class LinkToSalesforce extends AbstractButton<AbstractButtonProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.linkToSalesforce';
icon = IconCloudUpload;
label = 'toolbar.linkToSalesforce';
diff --git a/react/features/toolbox/components/web/OverflowMenuButton.tsx b/react/features/toolbox/components/web/OverflowMenuButton.tsx
index 09afe13ea7..c51961d7ac 100644
--- a/react/features/toolbox/components/web/OverflowMenuButton.tsx
+++ b/react/features/toolbox/components/web/OverflowMenuButton.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable lines-around-comment */
import React, { ReactNode, useCallback } from 'react';
import { useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
@@ -6,6 +5,7 @@ import { makeStyles } from 'tss-react/mui';
import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
import Popover from '../../../base/popover/components/Popover.web';
+// eslint-disable-next-line lines-around-comment
// @ts-ignore
import { ReactionEmoji, ReactionsMenu } from '../../../reactions/components';
import { REACTIONS_MENU_HEIGHT } from '../../../reactions/constants';
@@ -15,9 +15,7 @@ import { showOverflowDrawer } from '../../functions.web';
import Drawer from './Drawer';
import JitsiPortal from './JitsiPortal';
-// @ts-ignore
import OverflowToggleButton from './OverflowToggleButton';
-/* eslint-enable lines-around-comment */
/**
* The type of the React {@code Component} props of {@link OverflowMenuButton}.
diff --git a/react/features/toolbox/components/web/OverflowToggleButton.js b/react/features/toolbox/components/web/OverflowToggleButton.ts
similarity index 66%
rename from react/features/toolbox/components/web/OverflowToggleButton.js
rename to react/features/toolbox/components/web/OverflowToggleButton.ts
index 427f95e7aa..9567673bcd 100644
--- a/react/features/toolbox/components/web/OverflowToggleButton.js
+++ b/react/features/toolbox/components/web/OverflowToggleButton.ts
@@ -1,30 +1,30 @@
-// @flow
+import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconDotsHorizontal } from '../../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
+import { translate } from '../../../base/i18n/functions';
+import { IconDotsHorizontal } from '../../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
/**
* The type of the React {@code Component} props of {@link OverflowToggleButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether the more options menu is open.
*/
- isOpen: boolean,
+ isOpen: boolean;
/**
* External handler for key down action.
*/
- onKeyDown: Function,
-};
+ onKeyDown: Function;
+}
/**
* Implementation of a button for toggling the overflow menu.
*/
-class OverflowToggleButton extends AbstractButton<Props, *> {
+class OverflowToggleButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.moreActions';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.closeMoreActions';
icon = IconDotsHorizontal;
@@ -56,4 +56,4 @@ class OverflowToggleButton extends AbstractButton<Props, *> {
}
-export default translate(OverflowToggleButton);
+export default connect()(translate(OverflowToggleButton));
diff --git a/react/features/toolbox/components/web/ProfileButton.js b/react/features/toolbox/components/web/ProfileButton.ts
similarity index 63%
rename from react/features/toolbox/components/web/ProfileButton.js
rename to react/features/toolbox/components/web/ProfileButton.ts
index e1c9c83ce5..dc7e3c69ff 100644
--- a/react/features/toolbox/components/web/ProfileButton.js
+++ b/react/features/toolbox/components/web/ProfileButton.ts
@@ -1,54 +1,51 @@
-// @flow
-
import { connect } from 'react-redux';
-import { createToolbarEvent, sendAnalytics } from '../../../analytics';
-import { translate } from '../../../base/i18n';
-import { getLocalParticipant } from '../../../base/participants';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
-import { SETTINGS_TABS, openSettingsDialog } from '../../../settings';
+import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
+import { IReduxState } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { getLocalParticipant } from '../../../base/participants/functions';
+import { ILocalParticipant } from '../../../base/participants/types';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
+import { openSettingsDialog } from '../../../settings/actions';
+import { SETTINGS_TABS } from '../../../settings/constants';
import ProfileButtonAvatar from './ProfileButtonAvatar';
/**
* The type of the React {@code Component} props of {@link ProfileButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Default displayed name for local participant.
*/
- _defaultLocalDisplayName: string,
+ _defaultLocalDisplayName: string;
/**
* The redux representation of the local participant.
*/
- _localParticipant: Object,
+ _localParticipant?: ILocalParticipant;
/**
* Whether the button support clicking or not.
*/
- _unclickable: boolean,
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
-};
-
-declare var interfaceConfig: Object;
+ _unclickable: boolean;
+}
/**
* Implementation of a button for opening profile dialog.
*/
-class ProfileButton extends AbstractButton<Props, *> {
+class ProfileButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.profile';
icon = ProfileButtonAvatar;
/**
* Retrieves the label.
+ *
+ * @returns {string}
*/
- get label() {
+ _getLabel() {
const {
_defaultLocalDisplayName,
_localParticipant
@@ -64,29 +61,13 @@ class ProfileButton extends AbstractButton<Props, *> {
return displayName;
}
- /**
- * Required by linter due to AbstractButton overwritten prop being writable.
- *
- * @param {string} _value - The value.
- */
- set label(_value) {
- // Unused.
- }
-
/**
* Retrieves the tooltip.
- */
- get tooltip() {
- return this.label;
- }
-
- /**
- * Required by linter due to AbstractButton overwritten prop being writable.
*
- * @param {string} _value - The value.
+ * @returns {string}
*/
- set tooltip(_value) {
- // Unused.
+ _getTooltip() {
+ return this._getLabel();
}
/**
@@ -121,11 +102,11 @@ class ProfileButton extends AbstractButton<Props, *> {
* @param {Object} state - Redux state.
* @returns {Object}
*/
-const mapStateToProps = state => {
+const mapStateToProps = (state: IReduxState) => {
const { defaultLocalDisplayName } = state['features/base/config'];
return {
- _defaultLocalDisplayName: defaultLocalDisplayName,
+ _defaultLocalDisplayName: defaultLocalDisplayName ?? '',
_localParticipant: getLocalParticipant(state),
_unclickable: !interfaceConfig.SETTINGS_SECTIONS.includes('profile'),
customClass: 'profile-button-avatar'
diff --git a/react/features/toolbox/components/web/ProfileButtonAvatar.js b/react/features/toolbox/components/web/ProfileButtonAvatar.tsx
similarity index 63%
rename from react/features/toolbox/components/web/ProfileButtonAvatar.js
rename to react/features/toolbox/components/web/ProfileButtonAvatar.tsx
index 43c5c9610c..91b1ba67ea 100644
--- a/react/features/toolbox/components/web/ProfileButtonAvatar.js
+++ b/react/features/toolbox/components/web/ProfileButtonAvatar.tsx
@@ -1,24 +1,23 @@
-// @flow
-
import React, { Component } from 'react';
import { connect } from 'react-redux';
-import { Avatar } from '../../../base/avatar';
-import { translate } from '../../../base/i18n';
-import { getLocalParticipant } from '../../../base/participants';
+import { IReduxState } from '../../../app/types';
+import Avatar from '../../../base/avatar/components/Avatar';
+import { getLocalParticipant } from '../../../base/participants/functions';
+import { ILocalParticipant } from '../../../base/participants/types';
/**
* The type of the React {@code Component} props of
* {@link ProfileButtonAvatar}.
*/
-type Props = {
+interface IProps {
/**
* The redux representation of the local participant.
*/
- _localParticipant: Object,
+ _localParticipant?: ILocalParticipant;
-};
+}
/**
* A React {@code Component} for displaying a profile avatar as an
@@ -26,7 +25,7 @@ type Props = {
*
* @augments Component
*/
-class ProfileButtonAvatar extends Component<Props> {
+class ProfileButtonAvatar extends Component<IProps> {
/**
* Implements React's {@link Component#render()}.
*
@@ -38,7 +37,7 @@ class ProfileButtonAvatar extends Component<Props> {
return (
<Avatar
- participantId = { _localParticipant.id }
+ participantId = { _localParticipant?.id }
size = { 20 } />
);
}
@@ -54,10 +53,10 @@ class ProfileButtonAvatar extends Component<Props> {
* _localParticipant: Object,
* }}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
return {
_localParticipant: getLocalParticipant(state)
};
}
-export default translate(connect(_mapStateToProps)(ProfileButtonAvatar));
+export default connect(_mapStateToProps)(ProfileButtonAvatar);
diff --git a/react/features/toolbox/components/web/Separator.js b/react/features/toolbox/components/web/Separator.tsx
similarity index 100%
rename from react/features/toolbox/components/web/Separator.js
rename to react/features/toolbox/components/web/Separator.tsx
diff --git a/react/features/toolbox/components/web/ShareDesktopButton.js b/react/features/toolbox/components/web/ShareDesktopButton.ts
similarity index 77%
rename from react/features/toolbox/components/web/ShareDesktopButton.js
rename to react/features/toolbox/components/web/ShareDesktopButton.ts
index 4cf72a3fa7..3872982a79 100644
--- a/react/features/toolbox/components/web/ShareDesktopButton.js
+++ b/react/features/toolbox/components/web/ShareDesktopButton.ts
@@ -1,36 +1,32 @@
-// @flow
-
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconScreenshare, IconStopScreenshare } from '../../../base/icons';
+import { IReduxState } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { IconScreenshare, IconStopScreenshare } from '../../../base/icons/svg';
+// eslint-disable-next-line lines-around-comment
+// @ts-ignore
import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { isScreenVideoShared } from '../../../screen-share/functions';
import { isDesktopShareButtonDisabled } from '../../functions';
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether or not screensharing is initialized.
*/
- _desktopSharingEnabled: boolean,
+ _desktopSharingEnabled: boolean;
/**
* Whether or not the local participant is screensharing.
*/
- _screensharing: boolean,
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function,
-};
+ _screensharing: boolean;
+}
/**
* Implementation of a button for sharing desktop / windows.
*/
-class ShareDesktopButton extends AbstractButton<Props, *> {
+class ShareDesktopButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.shareYourScreen';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.stopScreenSharing';
label = 'toolbar.startScreenSharing';
@@ -40,8 +36,10 @@ class ShareDesktopButton extends AbstractButton<Props, *> {
/**
* Retrieves tooltip dynamically.
+ *
+ * @returns {string}
*/
- get tooltip() {
+ _getTooltip() {
const { _desktopSharingEnabled, _screensharing } = this.props;
if (_desktopSharingEnabled) {
@@ -55,15 +53,6 @@ class ShareDesktopButton extends AbstractButton<Props, *> {
return 'dialog.shareYourScreenDisabled';
}
- /**
- * Required by linter due to AbstractButton overwritten prop being writable.
- *
- * @param {string} _value - The icon value.
- */
- set tooltip(_value) {
- // Unused.
- }
-
/**
* Indicates whether this button is in toggled state or not.
*
@@ -93,7 +82,7 @@ class ShareDesktopButton extends AbstractButton<Props, *> {
* @param {Object} state - Redux state.
* @returns {Object}
*/
-const mapStateToProps = state => {
+const mapStateToProps = (state: IReduxState) => {
// Disable the screenshare button if the video sender limit is reached and there is no video or media share in
// progress.
const desktopSharingEnabled
diff --git a/react/features/toolbox/components/web/ToggleCameraButton.js b/react/features/toolbox/components/web/ToggleCameraButton.ts
similarity index 67%
rename from react/features/toolbox/components/web/ToggleCameraButton.js
rename to react/features/toolbox/components/web/ToggleCameraButton.ts
index 03e6391056..ca277dbcbe 100644
--- a/react/features/toolbox/components/web/ToggleCameraButton.js
+++ b/react/features/toolbox/components/web/ToggleCameraButton.ts
@@ -1,39 +1,34 @@
-// @flow
-
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconCameraRefresh } from '../../../base/icons';
-import { MEDIA_TYPE } from '../../../base/media';
-import { AbstractButton, type AbstractButtonProps } from '../../../base/toolbox/components';
-import { isLocalTrackMuted, isToggleCameraEnabled, toggleCamera } from '../../../base/tracks';
+import { IReduxState } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { IconCameraRefresh } from '../../../base/icons/svg';
+import { MEDIA_TYPE } from '../../../base/media/constants';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
+import { toggleCamera } from '../../../base/tracks/actions';
+import { isLocalTrackMuted, isToggleCameraEnabled } from '../../../base/tracks/functions';
import { setOverflowMenuVisible } from '../../actions.web';
/**
* The type of the React {@code Component} props of {@link ToggleCameraButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether the current conference is in audio only mode or not.
*/
- _audioOnly: boolean,
+ _audioOnly: boolean;
/**
* Whether video is currently muted or not.
*/
- _videoMuted: boolean,
-
- /**
- * The Redux dispatch function.
- */
- dispatch: Function
-};
+ _videoMuted: boolean;
+}
/**
* An implementation of a button for toggling the camera facing mode.
*/
-class ToggleCameraButton extends AbstractButton<Props, any> {
+class ToggleCameraButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.toggleCamera';
icon = IconCameraRefresh;
label = 'toolbar.toggleCamera';
@@ -65,9 +60,9 @@ class ToggleCameraButton extends AbstractButton<Props, any> {
* {@code ToggleCameraButton} component.
*
* @param {Object} state - The Redux state.
- * @returns {Props}
+ * @returns {IProps}
*/
-function mapStateToProps(state) {
+function mapStateToProps(state: IReduxState) {
const { enabled: audioOnly } = state['features/base/audio-only'];
const tracks = state['features/base/tracks'];
diff --git a/react/features/toolbox/components/web/Toolbox.tsx b/react/features/toolbox/components/web/Toolbox.tsx
index c3b46b4768..d5df715fe5 100644
--- a/react/features/toolbox/components/web/Toolbox.tsx
+++ b/react/features/toolbox/components/web/Toolbox.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable lines-around-comment */
import { withStyles } from '@mui/styles';
import React, { Component } from 'react';
import { WithTranslation } from 'react-i18next';
@@ -35,72 +34,50 @@ import { ITrack } from '../../../base/tracks/types';
import ContextMenu from '../../../base/ui/components/web/ContextMenu';
import ContextMenuItemGroup from '../../../base/ui/components/web/ContextMenuItemGroup';
import { toggleChat } from '../../../chat/actions.web';
-// @ts-ignore
-import { ChatButton } from '../../../chat/components';
-// @ts-ignore
-import { EmbedMeetingButton } from '../../../embed-meeting';
-// @ts-ignore
-import { SharedDocumentButton } from '../../../etherpad';
-// @ts-ignore
-import { FeedbackButton } from '../../../feedback';
+import ChatButton from '../../../chat/components/web/ChatButton';
+import EmbedMeetingButton from '../../../embed-meeting/components/EmbedMeetingButton';
+import SharedDocumentButton from '../../../etherpad/components/SharedDocumentButton';
+import FeedbackButton from '../../../feedback/components/FeedbackButton';
import { setGifMenuVisibility } from '../../../gifs/actions';
import { isGifEnabled } from '../../../gifs/functions';
-// @ts-ignore
-import { InviteButton } from '../../../invite/components/add-people-dialog';
+import InviteButton from '../../../invite/components/add-people-dialog/web/InviteButton';
import { isVpaasMeeting } from '../../../jaas/functions';
-// @ts-ignore
-import { KeyboardShortcutsButton } from '../../../keyboard-shortcuts';
+import KeyboardShortcutsButton from '../../../keyboard-shortcuts/components/web/KeyboardShortcutsButton';
import { NoiseSuppressionButton } from '../../../noise-suppression/components';
import {
close as closeParticipantsPane,
open as openParticipantsPane
} from '../../../participants-pane/actions.web';
-// @ts-ignore
-import { ParticipantsPaneButton } from '../../../participants-pane/components/web';
+import ParticipantsPaneButton from '../../../participants-pane/components/web/ParticipantsPaneButton';
import { getParticipantsPaneOpen } from '../../../participants-pane/functions';
import { addReactionToBuffer } from '../../../reactions/actions.any';
import { toggleReactionsMenuVisibility } from '../../../reactions/actions.web';
import ReactionsMenuButton from '../../../reactions/components/web/ReactionsMenuButton';
import { REACTIONS } from '../../../reactions/constants';
import { isReactionsEnabled } from '../../../reactions/functions.any';
-import {
- LiveStreamButton,
- RecordButton
- // @ts-ignore
-} from '../../../recording';
+import LiveStreamButton from '../../../recording/components/LiveStream/web/LiveStreamButton';
+import RecordButton from '../../../recording/components/Recording/web/RecordButton';
import { isSalesforceEnabled } from '../../../salesforce/functions';
import {
startScreenShareFlow
} from '../../../screen-share/actions.web';
-// @ts-ignore
import ShareAudioButton from '../../../screen-share/components/web/ShareAudioButton';
import {
isScreenAudioSupported,
isScreenVideoShared
} from '../../../screen-share/functions';
-// @ts-ignore
import SecurityDialogButton from '../../../security/components/security-dialog/web/SecurityDialogButton';
-// @ts-ignore
-import { SettingsButton } from '../../../settings';
-// @ts-ignore
-import { SharedVideoButton } from '../../../shared-video/components';
-// @ts-ignore
-import { SpeakerStatsButton } from '../../../speaker-stats/components/web';
+import SettingsButton from '../../../settings/components/web/SettingsButton';
+import SharedVideoButton from '../../../shared-video/components/web/SharedVideoButton';
import SpeakerStats from '../../../speaker-stats/components/web/SpeakerStats';
-import {
- ClosedCaptionButton
- // @ts-ignore
-} from '../../../subtitles';
-import {
- TileViewButton,
- shouldDisplayTileView,
- toggleTileView
- // @ts-ignore
-} from '../../../video-layout';
-// @ts-ignore
-import { VideoQualityButton, VideoQualityDialog } from '../../../video-quality/components';
-// @ts-ignore
-import { VideoBackgroundButton } from '../../../virtual-background';
+import SpeakerStatsButton from '../../../speaker-stats/components/web/SpeakerStatsButton';
+import ClosedCaptionButton from '../../../subtitles/components/ClosedCaptionButton';
+import { toggleTileView } from '../../../video-layout/actions.web';
+import TileViewButton from '../../../video-layout/components/TileViewButton';
+import { shouldDisplayTileView } from '../../../video-layout/functions.web';
+import VideoQualityButton from '../../../video-quality/components/VideoQualityButton';
+import VideoQualityDialog from '../../../video-quality/components/VideoQualityDialog';
+import VideoBackgroundButton from '../../../virtual-background/components/VideoBackgroundButton';
import { iAmVisitor } from '../../../visitors/functions';
import WhiteboardButton from '../../../whiteboard/components/web/WhiteboardButton';
import { isWhiteboardButtonVisible } from '../../../whiteboard/functions';
@@ -114,36 +91,23 @@ import {
import { NOTIFY_CLICK_MODE, NOT_APPLICABLE, THRESHOLDS } from '../../constants';
import { isDesktopShareButtonDisabled, isToolboxVisible } from '../../functions';
import { getJwtDisabledButtons } from '../../functions.any';
-// @ts-ignore
import DownloadButton from '../DownloadButton';
-// @ts-ignore
import HangupButton from '../HangupButton';
-// @ts-ignore
import HelpButton from '../HelpButton';
-// @ts-ignore
import AudioSettingsButton from './AudioSettingsButton';
import CustomOptionButton from './CustomOptionButton';
import { EndConferenceButton } from './EndConferenceButton';
-// @ts-ignore
import FullscreenButton from './FullscreenButton';
import HangupMenuButton from './HangupMenuButton';
import { LeaveConferenceButton } from './LeaveConferenceButton';
-// @ts-ignore
import LinkToSalesforceButton from './LinkToSalesforceButton';
-// @ts-ignore
import OverflowMenuButton from './OverflowMenuButton';
-// @ts-ignore
import ProfileButton from './ProfileButton';
-// @ts-ignore
import Separator from './Separator';
-// @ts-ignore
import ShareDesktopButton from './ShareDesktopButton';
-// @ts-ignore
import ToggleCameraButton from './ToggleCameraButton';
-// @ts-ignore
import VideoSettingsButton from './VideoSettingsButton';
-/* eslint-enable lines-around-comment */
/**
* The type of the React {@code Component} props of {@link Toolbox}.
diff --git a/react/features/toolbox/components/web/VideoSettingsButton.js b/react/features/toolbox/components/web/VideoSettingsButton.tsx
similarity index 77%
rename from react/features/toolbox/components/web/VideoSettingsButton.js
rename to react/features/toolbox/components/web/VideoSettingsButton.tsx
index 9e48144925..e8d2368e5a 100644
--- a/react/features/toolbox/components/web/VideoSettingsButton.js
+++ b/react/features/toolbox/components/web/VideoSettingsButton.tsx
@@ -1,88 +1,84 @@
-// @flow
-
import React, { Component } from 'react';
+import { WithTranslation } from 'react-i18next';
import { connect } from 'react-redux';
+import { IReduxState } from '../../../app/types';
import { isMobileBrowser } from '../../../base/environment/utils';
-import { translate } from '../../../base/i18n';
-import { IconArrowUp } from '../../../base/icons';
-import { ToolboxButtonWithIcon } from '../../../base/toolbox/components';
-import { getLocalJitsiVideoTrack } from '../../../base/tracks';
-import { VideoSettingsPopup, toggleVideoSettings } from '../../../settings';
-import { getVideoSettingsVisibility } from '../../../settings/functions';
-import { isVideoSettingsButtonDisabled } from '../../functions';
+import { translate } from '../../../base/i18n/functions';
+import { IconArrowUp } from '../../../base/icons/svg';
+import ToolboxButtonWithIcon from '../../../base/toolbox/components/web/ToolboxButtonWithIcon';
+import { getLocalJitsiVideoTrack } from '../../../base/tracks/functions.web';
+import { toggleVideoSettings } from '../../../settings/actions';
+import VideoSettingsPopup from '../../../settings/components/web/video/VideoSettingsPopup';
+import { getVideoSettingsVisibility } from '../../../settings/functions.web';
+import { isVideoSettingsButtonDisabled } from '../../functions.web';
import VideoMuteButton from '../VideoMuteButton';
-type Props = {
+interface IProps extends WithTranslation {
/**
* The button's key.
*/
- buttonKey?: string,
+ buttonKey?: string;
/**
* External handler for click action.
*/
- handleClick: Function,
-
- /**
- * Click handler for the small icon. Opens video options.
- */
- onVideoOptionsClick: Function,
+ handleClick: Function;
/**
* Indicates whether video permissions have been granted or denied.
*/
- hasPermissions: boolean,
+ hasPermissions: boolean;
/**
* Whether there is a video track or not.
*/
- hasVideoTrack: boolean,
+ hasVideoTrack: boolean;
/**
* If the button should be disabled.
*/
- isDisabled: boolean,
+ isDisabled: boolean;
/**
- * Notify mode for `toolbarButtonClicked` event -
- * whether to only notify or to also prevent button click routine.
+ * Defines is popup is open.
*/
- notifyMode?: string,
+ isOpen: boolean;
/**
- * Flag controlling the visibility of the button.
- * VideoSettings popup is currently disabled on mobile browsers
- * as mobile devices do not support capture of more than one
- * camera at a time.
+ * Notify mode for `toolbarButtonClicked` event -
+ * whether to only notify or to also prevent button click routine.
*/
- visible: boolean,
+ notifyMode?: string;
/**
- * Used for translation.
+ * Click handler for the small icon. Opens video options.
*/
- t: Function,
+ onVideoOptionsClick: Function;
/**
- * Defines is popup is open.
+ * Flag controlling the visibility of the button.
+ * VideoSettings popup is currently disabled on mobile browsers
+ * as mobile devices do not support capture of more than one
+ * camera at a time.
*/
- isOpen: boolean
-};
+ visible: boolean;
+}
/**
* Button used for video & video settings.
*
* @returns {ReactElement}
*/
-class VideoSettingsButton extends Component<Props> {
+class VideoSettingsButton extends Component<IProps> {
/**
* Initializes a new {@code VideoSettingsButton} instance.
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._onEscClick = this._onEscClick.bind(this);
@@ -99,7 +95,6 @@ class VideoSettingsButton extends Component<Props> {
return (!hasPermissions || isDisabled) && !hasVideoTrack;
}
- _onEscClick: (KeyboardEvent) => void;
/**
* Click handler for the more actions entries.
@@ -107,7 +102,7 @@ class VideoSettingsButton extends Component<Props> {
* @param {KeyboardEvent} event - Esc key click to close the popup.
* @returns {void}
*/
- _onEscClick(event) {
+ _onEscClick(event: React.KeyboardEvent) {
if (event.key === 'Escape' && this.props.isOpen) {
event.preventDefault();
event.stopPropagation();
@@ -115,8 +110,6 @@ class VideoSettingsButton extends Component<Props> {
}
}
- _onClick: () => void;
-
/**
* Click handler for the more actions entries.
*
@@ -168,15 +161,15 @@ class VideoSettingsButton extends Component<Props> {
* @param {Object} state - Redux state.
* @returns {Object}
*/
-function mapStateToProps(state) {
- const { permissions = {} } = state['features/base/devices'];
+function mapStateToProps(state: IReduxState) {
+ const { permissions = { video: false } } = state['features/base/devices'];
const { isNarrowLayout } = state['features/base/responsive-ui'];
return {
hasPermissions: permissions.video,
hasVideoTrack: Boolean(getLocalJitsiVideoTrack(state)),
isDisabled: isVideoSettingsButtonDisabled(state),
- isOpen: getVideoSettingsVisibility(state),
+ isOpen: Boolean(getVideoSettingsVisibility(state)),
visible: !isMobileBrowser() && !isNarrowLayout
};
}
diff --git a/react/features/video-layout/components/TileViewButton.js b/react/features/video-layout/components/TileViewButton.ts
similarity index 74%
rename from react/features/video-layout/components/TileViewButton.js
rename to react/features/video-layout/components/TileViewButton.ts
index 125a476118..90965ee3fe 100644
--- a/react/features/video-layout/components/TileViewButton.js
+++ b/react/features/video-layout/components/TileViewButton.ts
@@ -1,15 +1,13 @@
-// @flow
import { batch, connect } from 'react-redux';
-import type { Dispatch } from 'redux';
-import {
- createToolbarEvent,
- sendAnalytics
-} from '../../analytics';
-import { TILE_VIEW_ENABLED, getFeatureFlag } from '../../base/flags';
-import { translate } from '../../base/i18n';
-import { IconTileView } from '../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
+import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
+import { IReduxState } from '../../app/types';
+import { TILE_VIEW_ENABLED } from '../../base/flags/constants';
+import { getFeatureFlag } from '../../base/flags/functions';
+import { translate } from '../../base/i18n/functions';
+import { IconTileView } from '../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
import { setOverflowMenuVisible } from '../../toolbox/actions';
import { setTileView } from '../actions';
import { shouldDisplayTileView } from '../functions';
@@ -18,25 +16,20 @@ import logger from '../logger';
/**
* The type of the React {@code Component} props of {@link TileViewButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether or not tile view layout has been enabled as the user preference.
*/
- _tileViewEnabled: boolean,
-
- /**
- * Used to dispatch actions from the buttons.
- */
- dispatch: Dispatch<any>
-};
+ _tileViewEnabled: boolean;
+}
/**
* Component that renders a toolbar button for toggling the tile layout view.
*
* @augments AbstractButton
*/
-class TileViewButton<P: Props> extends AbstractButton<P, *> {
+class TileViewButton<P extends IProps> extends AbstractButton<P> {
accessibilityLabel = 'toolbar.accessibilityLabel.enterTileView';
toggledAccessibilityLabel = 'toolbar.accessibilityLabel.exitTileView';
icon = IconTileView;
@@ -88,9 +81,9 @@ class TileViewButton<P: Props> extends AbstractButton<P, *> {
*
* @param {Object} state - The Redux state.
* @param {Object} ownProps - The properties explicitly passed to the component instance.
- * @returns {Props}
+ * @returns {IProps}
*/
-function _mapStateToProps(state, ownProps) {
+function _mapStateToProps(state: IReduxState, ownProps: any) {
const enabled = getFeatureFlag(state, TILE_VIEW_ENABLED, true);
const { visible = enabled } = ownProps;
diff --git a/react/features/video-menu/components/AbstractGrantModeratorButton.ts b/react/features/video-menu/components/AbstractGrantModeratorButton.ts
index 7a78e238cd..82131f12b1 100644
--- a/react/features/video-menu/components/AbstractGrantModeratorButton.ts
+++ b/react/features/video-menu/components/AbstractGrantModeratorButton.ts
@@ -46,7 +46,7 @@ export default class AbstractGrantModeratorButton extends AbstractButton<IProps>
* visible: boolean
* }}
*/
-export function _mapStateToProps(state: IReduxState, ownProps: IProps) {
+export function _mapStateToProps(state: IReduxState, ownProps: any) {
const { participantID } = ownProps;
const localParticipant = getLocalParticipant(state);
diff --git a/react/features/video-menu/components/AbstractMuteButton.ts b/react/features/video-menu/components/AbstractMuteButton.ts
index 2657f59c0f..31de5f85a6 100644
--- a/react/features/video-menu/components/AbstractMuteButton.ts
+++ b/react/features/video-menu/components/AbstractMuteButton.ts
@@ -80,7 +80,7 @@ export default class AbstractMuteButton extends AbstractButton<IProps> {
* _audioTrackMuted: boolean
* }}
*/
-export function _mapStateToProps(state: IReduxState, ownProps: IProps) {
+export function _mapStateToProps(state: IReduxState, ownProps: any) {
const tracks = state['features/base/tracks'];
return {
diff --git a/react/features/video-menu/components/AbstractMuteVideoButton.ts b/react/features/video-menu/components/AbstractMuteVideoButton.ts
index fc908c8b44..42c2660c19 100644
--- a/react/features/video-menu/components/AbstractMuteVideoButton.ts
+++ b/react/features/video-menu/components/AbstractMuteVideoButton.ts
@@ -80,7 +80,7 @@ export default class AbstractMuteVideoButton extends AbstractButton<IProps> {
* _videoTrackMuted: boolean
* }}
*/
-export function _mapStateToProps(state: IReduxState, ownProps: IProps) {
+export function _mapStateToProps(state: IReduxState, ownProps: any) {
const tracks = state['features/base/tracks'];
return {
diff --git a/react/features/video-menu/components/web/AskToUnmuteButton.tsx b/react/features/video-menu/components/web/AskToUnmuteButton.tsx
index b7fa60b84a..8d3048a36b 100644
--- a/react/features/video-menu/components/web/AskToUnmuteButton.tsx
+++ b/react/features/video-menu/components/web/AskToUnmuteButton.tsx
@@ -1,5 +1,3 @@
-// @flow
-
import React, { useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';
@@ -9,7 +7,7 @@ import { IconMic, IconVideo } from '../../../base/icons/svg';
import { MEDIA_TYPE, MediaType } from '../../../base/media/constants';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-type Props = {
+interface IProps {
buttonType: MediaType;
@@ -17,9 +15,9 @@ type Props = {
* The ID for the participant on which the button will act.
*/
participantID: string;
-};
+}
-const AskToUnmuteButton = ({ buttonType, participantID }: Props) => {
+const AskToUnmuteButton = ({ buttonType, participantID }: IProps) => {
const dispatch = useDispatch();
const { t } = useTranslation();
const _onClick = useCallback(() => {
diff --git a/react/features/video-menu/components/web/ConnectionStatusButton.js b/react/features/video-menu/components/web/ConnectionStatusButton.tsx
similarity index 72%
rename from react/features/video-menu/components/web/ConnectionStatusButton.js
rename to react/features/video-menu/components/web/ConnectionStatusButton.tsx
index 76e1744c94..22654a2b08 100644
--- a/react/features/video-menu/components/web/ConnectionStatusButton.js
+++ b/react/features/video-menu/components/web/ConnectionStatusButton.tsx
@@ -1,35 +1,31 @@
-// @flow
import React, { useCallback } from 'react';
+import { WithTranslation } from 'react-i18next';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconInfoCircle } from '../../../base/icons';
+import { IStore } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { IconInfoCircle } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
import { renderConnectionStatus } from '../../actions.web';
-type Props = {
+interface IProps extends WithTranslation {
/**
* The Redux dispatch function.
*/
- dispatch: Function,
+ dispatch: IStore['dispatch'];
/**
* The ID of the participant for which to show connection stats.
*/
- participantId: string,
-
- /**
- * The function to be used to translate i18n labels.
- */
- t: Function
-};
+ participantId: string;
+}
const ConnectionStatusButton = ({
dispatch,
t
-}: Props) => {
+}: IProps) => {
const onClick = useCallback(e => {
e.stopPropagation();
dispatch(renderConnectionStatus(true));
diff --git a/react/features/video-menu/components/web/FakeParticipantContextMenu.tsx b/react/features/video-menu/components/web/FakeParticipantContextMenu.tsx
index d2d9055cfb..231fe501ae 100644
--- a/react/features/video-menu/components/web/FakeParticipantContextMenu.tsx
+++ b/react/features/video-menu/components/web/FakeParticipantContextMenu.tsx
@@ -2,7 +2,6 @@ import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
-// @ts-ignore
import TogglePinToStageButton from '../../../../features/video-menu/components/web/TogglePinToStageButton';
import Avatar from '../../../base/avatar/components/Avatar';
import { IconPlay } from '../../../base/icons/svg';
diff --git a/react/features/video-menu/components/web/FlipLocalVideoButton.js b/react/features/video-menu/components/web/FlipLocalVideoButton.tsx
similarity index 79%
rename from react/features/video-menu/components/web/FlipLocalVideoButton.js
rename to react/features/video-menu/components/web/FlipLocalVideoButton.tsx
index f4cea085d1..58b1a5882d 100644
--- a/react/features/video-menu/components/web/FlipLocalVideoButton.js
+++ b/react/features/video-menu/components/web/FlipLocalVideoButton.tsx
@@ -1,56 +1,51 @@
-/* @flow */
-
import React, { PureComponent } from 'react';
+import { WithTranslation } from 'react-i18next';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { updateSettings } from '../../../base/settings';
+import { IReduxState, IStore } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { updateSettings } from '../../../base/settings/actions';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
/**
* The type of the React {@code Component} props of {@link FlipLocalVideoButton}.
*/
-type Props = {
+interface IProps extends WithTranslation {
/**
* The current local flip x status.
*/
- _localFlipX: boolean,
+ _localFlipX: boolean;
/**
* Button text class name.
*/
- className: string,
+ className: string;
/**
* The redux dispatch function.
*/
- dispatch: Function,
+ dispatch: IStore['dispatch'];
/**
* Click handler executed aside from the main action.
*/
- onClick?: Function,
-
- /**
- * Invoked to obtain translated strings.
- */
- t: Function
-};
+ onClick?: Function;
+}
/**
* Implements a React {@link Component} which displays a button for flipping the local viedo.
*
* @augments Component
*/
-class FlipLocalVideoButton extends PureComponent<Props> {
+class FlipLocalVideoButton extends PureComponent<IProps> {
/**
* Initializes a new {@code FlipLocalVideoButton} instance.
*
* @param {Object} props - The read-only React Component props with which
* the new instance is to be initialized.
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
// Bind event handlers so they are only bound once for every instance.
@@ -80,8 +75,6 @@ class FlipLocalVideoButton extends PureComponent<Props> {
);
}
- _onClick: () => void;
-
/**
* Flips the local video.
*
@@ -91,7 +84,7 @@ class FlipLocalVideoButton extends PureComponent<Props> {
_onClick() {
const { _localFlipX, dispatch, onClick } = this.props;
- onClick && onClick();
+ onClick?.();
dispatch(updateSettings({
localFlipX: !_localFlipX
}));
@@ -103,9 +96,9 @@ class FlipLocalVideoButton extends PureComponent<Props> {
*
* @param {Object} state - The Redux state.
* @private
- * @returns {Props}
+ * @returns {IProps}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
const { localFlipX } = state['features/base/settings'];
return {
diff --git a/react/features/video-menu/components/web/GrantModeratorButton.js b/react/features/video-menu/components/web/GrantModeratorButton.tsx
similarity index 83%
rename from react/features/video-menu/components/web/GrantModeratorButton.js
rename to react/features/video-menu/components/web/GrantModeratorButton.tsx
index 61169ddb1b..2a3adb7166 100644
--- a/react/features/video-menu/components/web/GrantModeratorButton.js
+++ b/react/features/video-menu/components/web/GrantModeratorButton.tsx
@@ -1,17 +1,10 @@
-/* @flow */
-
import React from 'react';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconModerator } from '../../../base/icons';
+import { translate } from '../../../base/i18n/functions';
+import { IconModerator } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import AbstractGrantModeratorButton, {
- type Props,
- _mapStateToProps
-} from '../AbstractGrantModeratorButton';
-
-declare var interfaceConfig: Object;
+import AbstractGrantModeratorButton, { IProps, _mapStateToProps } from '../AbstractGrantModeratorButton';
/**
* Implements a React {@link Component} which displays a button for granting
@@ -23,7 +16,7 @@ class GrantModeratorButton extends AbstractGrantModeratorButton {
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._handleClick = this._handleClick.bind(this);
diff --git a/react/features/video-menu/components/web/HideSelfViewVideoButton.js b/react/features/video-menu/components/web/HideSelfViewVideoButton.tsx
similarity index 77%
rename from react/features/video-menu/components/web/HideSelfViewVideoButton.js
rename to react/features/video-menu/components/web/HideSelfViewVideoButton.tsx
index f226c9e3e3..f7c5bd6af9 100644
--- a/react/features/video-menu/components/web/HideSelfViewVideoButton.js
+++ b/react/features/video-menu/components/web/HideSelfViewVideoButton.tsx
@@ -1,56 +1,52 @@
-/* @flow */
-
import React, { PureComponent } from 'react';
+import { WithTranslation } from 'react-i18next';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { getHideSelfView, updateSettings } from '../../../base/settings';
+import { IReduxState, IStore } from '../../../app/types';
+import { translate } from '../../../base/i18n/functions';
+import { updateSettings } from '../../../base/settings/actions';
+import { getHideSelfView } from '../../../base/settings/functions';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
/**
* The type of the React {@code Component} props of {@link HideSelfViewVideoButton}.
*/
-type Props = {
+interface IProps extends WithTranslation {
/**
- * Whether or not to hide the self view.
+ * Button text class name.
*/
- disableSelfView: boolean,
+ className: string;
/**
- * The redux dispatch function.
+ * Whether or not to hide the self view.
*/
- dispatch: Function,
+ disableSelfView: boolean;
/**
- * Button text class name.
+ * The redux dispatch function.
*/
- className: string,
+ dispatch: IStore['dispatch'];
/**
* Click handler executed aside from the main action.
*/
- onClick?: Function,
-
- /**
- * Invoked to obtain translated strings.
- */
- t: Function
-};
+ onClick?: Function;
+}
/**
* Implements a React {@link Component} which displays a button for hiding the local video.
*
* @augments Component
*/
-class HideSelfViewVideoButton extends PureComponent<Props> {
+class HideSelfViewVideoButton extends PureComponent<IProps> {
/**
* Initializes a new {@code HideSelfViewVideoButton} instance.
*
* @param {Object} props - The read-only React Component props with which
* the new instance is to be initialized.
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
// Bind event handlers so they are only bound once for every instance.
@@ -80,8 +76,6 @@ class HideSelfViewVideoButton extends PureComponent<Props> {
);
}
- _onClick: () => void;
-
/**
* Hides the local video.
*
@@ -91,7 +85,7 @@ class HideSelfViewVideoButton extends PureComponent<Props> {
_onClick() {
const { disableSelfView, dispatch, onClick } = this.props;
- onClick && onClick();
+ onClick?.();
dispatch(updateSettings({
disableSelfView: !disableSelfView
}));
@@ -103,9 +97,9 @@ class HideSelfViewVideoButton extends PureComponent<Props> {
*
* @param {Object} state - The Redux state.
* @private
- * @returns {Props}
+ * @returns {IProps}
*/
-function _mapStateToProps(state) {
+function _mapStateToProps(state: IReduxState) {
return {
disableSelfView: Boolean(getHideSelfView(state))
};
diff --git a/react/features/video-menu/components/web/KickButton.js b/react/features/video-menu/components/web/KickButton.tsx
similarity index 87%
rename from react/features/video-menu/components/web/KickButton.js
rename to react/features/video-menu/components/web/KickButton.tsx
index c9c30f00af..41368a6a32 100644
--- a/react/features/video-menu/components/web/KickButton.js
+++ b/react/features/video-menu/components/web/KickButton.tsx
@@ -1,14 +1,10 @@
-/* @flow */
-
import React from 'react';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconUserDeleted } from '../../../base/icons';
+import { translate } from '../../../base/i18n/functions';
+import { IconUserDeleted } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import AbstractKickButton, {
- type Props
-} from '../AbstractKickButton';
+import AbstractKickButton, { IProps } from '../AbstractKickButton';
/**
* Implements a React {@link Component} which displays a button for kicking out
@@ -26,7 +22,7 @@ class KickButton extends AbstractKickButton {
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._handleClick = this._handleClick.bind(this);
diff --git a/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx b/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx
index 24ea83e57b..47019ac821 100644
--- a/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx
+++ b/react/features/video-menu/components/web/LocalVideoMenuTriggerButton.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable lines-around-comment */
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { batch, connect } from 'react-redux';
@@ -15,21 +14,15 @@ import { getLocalVideoTrack } from '../../../base/tracks/functions';
import Button from '../../../base/ui/components/web/Button';
import ContextMenu from '../../../base/ui/components/web/ContextMenu';
import ContextMenuItemGroup from '../../../base/ui/components/web/ContextMenuItemGroup';
-// @ts-ignore
import ConnectionIndicatorContent from '../../../connection-indicator/components/web/ConnectionIndicatorContent';
import { THUMBNAIL_TYPE } from '../../../filmstrip/constants';
import { isStageFilmstripAvailable } from '../../../filmstrip/functions.web';
import { renderConnectionStatus } from '../../actions.web';
-// @ts-ignore
import ConnectionStatusButton from './ConnectionStatusButton';
-// @ts-ignore
import FlipLocalVideoButton from './FlipLocalVideoButton';
-// @ts-ignore
import HideSelfViewVideoButton from './HideSelfViewVideoButton';
-// @ts-ignore
import TogglePinToStageButton from './TogglePinToStageButton';
-/* eslint-enable lines-around-comment */
/**
* The type of the React {@code Component} props of
diff --git a/react/features/video-menu/components/web/MuteButton.js b/react/features/video-menu/components/web/MuteButton.tsx
similarity index 86%
rename from react/features/video-menu/components/web/MuteButton.js
rename to react/features/video-menu/components/web/MuteButton.tsx
index 65a720b1aa..9782b2d751 100644
--- a/react/features/video-menu/components/web/MuteButton.js
+++ b/react/features/video-menu/components/web/MuteButton.tsx
@@ -1,15 +1,10 @@
-/* @flow */
-
import React from 'react';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconMicSlash } from '../../../base/icons';
+import { translate } from '../../../base/i18n/functions';
+import { IconMicSlash } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import AbstractMuteButton, {
- type Props,
- _mapStateToProps
-} from '../AbstractMuteButton';
+import AbstractMuteButton, { IProps, _mapStateToProps } from '../AbstractMuteButton';
/**
@@ -28,7 +23,7 @@ class MuteButton extends AbstractMuteButton {
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._handleClick = this._handleClick.bind(this);
diff --git a/react/features/video-menu/components/web/MuteEveryoneElseButton.js b/react/features/video-menu/components/web/MuteEveryoneElseButton.tsx
similarity index 83%
rename from react/features/video-menu/components/web/MuteEveryoneElseButton.js
rename to react/features/video-menu/components/web/MuteEveryoneElseButton.tsx
index 1242637393..82831bb650 100644
--- a/react/features/video-menu/components/web/MuteEveryoneElseButton.js
+++ b/react/features/video-menu/components/web/MuteEveryoneElseButton.tsx
@@ -1,14 +1,10 @@
-// @flow
-
import React from 'react';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconMicSlash } from '../../../base/icons';
+import { translate } from '../../../base/i18n/functions';
+import { IconMicSlash } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import AbstractMuteEveryoneElseButton, {
- type Props
-} from '../AbstractMuteEveryoneElseButton';
+import AbstractMuteEveryoneElseButton, { IProps } from '../AbstractMuteEveryoneElseButton';
/**
* Implements a React {@link Component} which displays a button for audio muting
@@ -21,7 +17,7 @@ class MuteEveryoneElseButton extends AbstractMuteEveryoneElseButton {
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._handleClick = this._handleClick.bind(this);
diff --git a/react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.js b/react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.tsx
similarity index 83%
rename from react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.js
rename to react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.tsx
index bf1a966e81..ca9e20eb66 100644
--- a/react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.js
+++ b/react/features/video-menu/components/web/MuteEveryoneElsesVideoButton.tsx
@@ -1,14 +1,10 @@
-// @flow
-
import React from 'react';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconVideoOff } from '../../../base/icons';
+import { translate } from '../../../base/i18n/functions';
+import { IconVideoOff } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import AbstractMuteEveryoneElsesVideoButton, {
- type Props
-} from '../AbstractMuteEveryoneElsesVideoButton';
+import AbstractMuteEveryoneElsesVideoButton, { IProps } from '../AbstractMuteEveryoneElsesVideoButton';
/**
* Implements a React {@link Component} which displays a button for audio muting
@@ -21,7 +17,7 @@ class MuteEveryoneElsesVideoButton extends AbstractMuteEveryoneElsesVideoButton
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._handleClick = this._handleClick.bind(this);
diff --git a/react/features/video-menu/components/web/MuteVideoButton.js b/react/features/video-menu/components/web/MuteVideoButton.tsx
similarity index 86%
rename from react/features/video-menu/components/web/MuteVideoButton.js
rename to react/features/video-menu/components/web/MuteVideoButton.tsx
index 48cbb18188..77abae6450 100644
--- a/react/features/video-menu/components/web/MuteVideoButton.js
+++ b/react/features/video-menu/components/web/MuteVideoButton.tsx
@@ -1,15 +1,10 @@
-/* @flow */
-
import React from 'react';
import { connect } from 'react-redux';
-import { translate } from '../../../base/i18n';
-import { IconVideoOff } from '../../../base/icons';
+import { translate } from '../../../base/i18n/functions';
+import { IconVideoOff } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
-import AbstractMuteVideoButton, {
- type Props,
- _mapStateToProps
-} from '../AbstractMuteVideoButton';
+import AbstractMuteVideoButton, { IProps, _mapStateToProps } from '../AbstractMuteVideoButton';
/**
* Implements a React {@link Component} which displays a button for disabling
@@ -27,7 +22,7 @@ class MuteVideoButton extends AbstractMuteVideoButton {
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._handleClick = this._handleClick.bind(this);
diff --git a/react/features/video-menu/components/web/ParticipantContextMenu.tsx b/react/features/video-menu/components/web/ParticipantContextMenu.tsx
index 4847f2d059..73122e54ea 100644
--- a/react/features/video-menu/components/web/ParticipantContextMenu.tsx
+++ b/react/features/video-menu/components/web/ParticipantContextMenu.tsx
@@ -1,11 +1,9 @@
-/* eslint-disable lines-around-comment */
-
import React, { useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
-import { IReduxState } from '../../../app/types';
+import { IReduxState, IStore } from '../../../app/types';
import { isSupported as isAvModerationSupported } from '../../../av-moderation/functions';
import Avatar from '../../../base/avatar/components/Avatar';
import { isIosMobileBrowser, isMobileBrowser } from '../../../base/environment/utils';
@@ -26,29 +24,21 @@ import { requestRemoteControl, stopController } from '../../../remote-control/ac
import { showOverflowDrawer } from '../../../toolbox/functions.web';
import { iAmVisitor } from '../../../visitors/functions';
+import AskToUnmuteButton from './AskToUnmuteButton';
+import ConnectionStatusButton from './ConnectionStatusButton';
import CustomOptionButton from './CustomOptionButton';
-// @ts-ignore
-import { REMOTE_CONTROL_MENU_STATES } from './RemoteControlButton';
-// @ts-ignore
+import GrantModeratorButton from './GrantModeratorButton';
+import KickButton from './KickButton';
+import MuteButton from './MuteButton';
+import MuteEveryoneElseButton from './MuteEveryoneElseButton';
+import MuteEveryoneElsesVideoButton from './MuteEveryoneElsesVideoButton';
+import MuteVideoButton from './MuteVideoButton';
+import PrivateMessageMenuButton from './PrivateMessageMenuButton';
+import RemoteControlButton, { REMOTE_CONTROL_MENU_STATES } from './RemoteControlButton';
import SendToRoomButton from './SendToRoomButton';
+import TogglePinToStageButton from './TogglePinToStageButton';
import VerifyParticipantButton from './VerifyParticipantButton';
-
-import {
- AskToUnmuteButton,
- ConnectionStatusButton,
- GrantModeratorButton,
- KickButton,
- MuteButton,
- MuteEveryoneElseButton,
- MuteEveryoneElsesVideoButton,
- MuteVideoButton,
- PrivateMessageMenuButton,
- RemoteControlButton,
- TogglePinToStageButton,
- VolumeSlider
- // @ts-ignore
-} from './';
-/* eslint-enable lines-around-comment */
+import VolumeSlider from './VolumeSlider';
interface IProps {
@@ -133,7 +123,7 @@ const ParticipantContextMenu = ({
remoteControlState,
thumbnailMenu
}: IProps) => {
- const dispatch = useDispatch();
+ const dispatch: IStore['dispatch'] = useDispatch();
const { t } = useTranslation();
const { classes: styles } = useStyles();
@@ -157,7 +147,7 @@ const ParticipantContextMenu = ({
const shouldDisplayVerification = useSelector((state: IReduxState) => displayVerification(state, participant?.id));
const _currentRoomId = useSelector(getCurrentRoomId);
- const _rooms: Array<{ id: string; }> = Object.values(useSelector(getBreakoutRooms));
+ const _rooms = Object.values(useSelector(getBreakoutRooms));
const _onVolumeChange = useCallback(value => {
dispatch(setVolume(participant.id, value));
diff --git a/react/features/video-menu/components/web/PrivateMessageMenuButton.js b/react/features/video-menu/components/web/PrivateMessageMenuButton.tsx
similarity index 67%
rename from react/features/video-menu/components/web/PrivateMessageMenuButton.js
rename to react/features/video-menu/components/web/PrivateMessageMenuButton.tsx
index d2a42142bd..a2b91a9ced 100644
--- a/react/features/video-menu/components/web/PrivateMessageMenuButton.js
+++ b/react/features/video-menu/components/web/PrivateMessageMenuButton.tsx
@@ -1,28 +1,36 @@
-// @flow
-
import React, { Component } from 'react';
+import { WithTranslation } from 'react-i18next';
import { connect } from 'react-redux';
-import { CHAT_ENABLED, getFeatureFlag } from '../../../base/flags';
-import { translate } from '../../../base/i18n';
-import { IconMessage } from '../../../base/icons';
-import { getParticipantById } from '../../../base/participants';
+import { IReduxState, IStore } from '../../../app/types';
+import { CHAT_ENABLED } from '../../../base/flags/constants';
+import { getFeatureFlag } from '../../../base/flags/functions';
+import { translate } from '../../../base/i18n/functions';
+import { IconMessage } from '../../../base/icons/svg';
+import { getParticipantById } from '../../../base/participants/functions';
+import { IParticipant } from '../../../base/participants/types';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
import { openChat } from '../../../chat/actions.web';
-import {
- type Props as AbstractProps
-} from '../../../chat/components/web/PrivateMessageButton';
+import { IProps as AbstractProps } from '../../../chat/components/web/PrivateMessageButton';
import { isButtonEnabled } from '../../../toolbox/functions.web';
-declare var interfaceConfig: Object;
-
-type Props = AbstractProps & {
+interface IProps extends AbstractProps, WithTranslation {
/**
* True if the private chat functionality is disabled, hence the button is not visible.
*/
- _hidden: boolean
-};
+ _hidden: boolean;
+
+ /**
+ * The participant to send the message to.
+ */
+ _participant?: IParticipant;
+
+ /**
+ * Redux dispatch function.
+ */
+ dispatch: IStore['dispatch'];
+}
/**
* A custom implementation of the PrivateMessageButton specialized for
@@ -30,13 +38,13 @@ type Props = AbstractProps & {
* the {@code AbstractButton} component for the remote video menu, we can get rid
* of this component and use the generic button in the chat feature.
*/
-class PrivateMessageMenuButton extends Component<Props> {
+class PrivateMessageMenuButton extends Component<IProps> {
/**
* Instantiates a new Component instance.
*
* @inheritdoc
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
this._onClick = this._onClick.bind(this);
@@ -64,8 +72,6 @@ class PrivateMessageMenuButton extends Component<Props> {
);
}
- _onClick: () => void;
-
/**
* Callback to be invoked on pressing the button.
*
@@ -82,10 +88,10 @@ class PrivateMessageMenuButton extends Component<Props> {
* Maps part of the Redux store to the props of this component.
*
* @param {Object} state - The Redux state.
- * @param {Props} ownProps - The own props of the component.
- * @returns {Props}
+ * @param {IProps} ownProps - The own props of the component.
+ * @returns {IProps}
*/
-function _mapStateToProps(state: Object, ownProps: Props) {
+function _mapStateToProps(state: IReduxState, ownProps: any) {
const enabled = getFeatureFlag(state, CHAT_ENABLED, true);
const { visible = enabled } = ownProps;
diff --git a/react/features/video-menu/components/web/RemoteControlButton.js b/react/features/video-menu/components/web/RemoteControlButton.tsx
similarity index 87%
rename from react/features/video-menu/components/web/RemoteControlButton.js
rename to react/features/video-menu/components/web/RemoteControlButton.tsx
index 8ea2b09e10..7eae103584 100644
--- a/react/features/video-menu/components/web/RemoteControlButton.js
+++ b/react/features/video-menu/components/web/RemoteControlButton.tsx
@@ -1,13 +1,10 @@
-/* @flow */
-
import React, { Component } from 'react';
+import { WithTranslation } from 'react-i18next';
-import {
- createRemoteVideoMenuButtonEvent,
- sendAnalytics
-} from '../../../analytics';
-import { translate } from '../../../base/i18n';
-import { IconRemoteControlStart, IconRemoteControlStop } from '../../../base/icons';
+import { createRemoteVideoMenuButtonEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
+import { translate } from '../../../base/i18n/functions';
+import { IconRemoteControlStart, IconRemoteControlStop } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
// TODO: Move these enums into the store after further reactification of the
@@ -22,29 +19,24 @@ export const REMOTE_CONTROL_MENU_STATES = {
/**
* The type of the React {@code Component} props of {@link RemoteControlButton}.
*/
-type Props = {
+interface IProps extends WithTranslation {
/**
* The callback to invoke when the component is clicked.
*/
- onClick: Function,
+ onClick: (() => void) | null;
/**
* The ID of the participant linked to the onClick callback.
*/
- participantID: string,
+ participantID: string;
/**
* The current status of remote control. Should be a number listed in the
* enum REMOTE_CONTROL_MENU_STATES.
*/
- remoteControlState: number,
-
- /**
- * Invoked to obtain translated strings.
- */
- t: Function
-};
+ remoteControlState: number;
+}
/**
* Implements a React {@link Component} which displays a button showing the
@@ -53,14 +45,14 @@ type Props = {
*
* @augments Component
*/
-class RemoteControlButton extends Component<Props> {
+class RemoteControlButton extends Component<IProps> {
/**
* Initializes a new {@code RemoteControlButton} instance.
*
* @param {Object} props - The read-only React Component props with which
* the new instance is to be initialized.
*/
- constructor(props: Props) {
+ constructor(props: IProps) {
super(props);
// Bind event handlers so they are only bound once for every instance.
@@ -110,8 +102,6 @@ class RemoteControlButton extends Component<Props> {
);
}
- _onClick: () => void;
-
/**
* Sends analytics event for pressing the button and executes the passed
* onClick handler.
diff --git a/react/features/video-menu/components/web/RemoteVideoMenuTriggerButton.tsx b/react/features/video-menu/components/web/RemoteVideoMenuTriggerButton.tsx
index 1c36a3a708..56294c02a1 100644
--- a/react/features/video-menu/components/web/RemoteVideoMenuTriggerButton.tsx
+++ b/react/features/video-menu/components/web/RemoteVideoMenuTriggerButton.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable lines-around-comment */
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { batch, connect } from 'react-redux';
@@ -13,16 +12,13 @@ import Popover from '../../../base/popover/components/Popover.web';
import { setParticipantContextMenuOpen } from '../../../base/responsive-ui/actions';
import Button from '../../../base/ui/components/web/Button';
import ConnectionIndicatorContent from
-// @ts-ignore
'../../../connection-indicator/components/web/ConnectionIndicatorContent';
import { THUMBNAIL_TYPE } from '../../../filmstrip/constants';
import { renderConnectionStatus } from '../../actions.web';
import FakeParticipantContextMenu from './FakeParticipantContextMenu';
import ParticipantContextMenu from './ParticipantContextMenu';
-// @ts-ignore
import { REMOTE_CONTROL_MENU_STATES } from './RemoteControlButton';
-/* eslint-enable lines-around-comment */
/**
* The type of the React {@code Component} props of
@@ -59,7 +55,7 @@ interface IProps {
/**
* The current state of the participant's remote control session.
*/
- _remoteControlState: number;
+ _remoteControlState?: number;
/**
* Whether the popover should render the Connection Info stats.
@@ -223,7 +219,7 @@ const RemoteVideoMenuTriggerButton = ({
*/
function _mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {
const { participantID, thumbnailType } = ownProps;
- let _remoteControlState = null;
+ let _remoteControlState;
const localParticipantId = getLocalParticipant(state)?.id;
const participant = getParticipantById(state, participantID ?? '');
const _participantDisplayName = participant?.name;
diff --git a/react/features/video-menu/components/web/SendToRoomButton.js b/react/features/video-menu/components/web/SendToRoomButton.tsx
similarity index 70%
rename from react/features/video-menu/components/web/SendToRoomButton.js
rename to react/features/video-menu/components/web/SendToRoomButton.tsx
index d3b9677a8a..b604b7f5e5 100644
--- a/react/features/video-menu/components/web/SendToRoomButton.js
+++ b/react/features/video-menu/components/web/SendToRoomButton.tsx
@@ -1,37 +1,37 @@
-// @flow
-
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';
-import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
-import { IconRingGroup } from '../../../base/icons';
+import { createBreakoutRoomsEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
+import { IconRingGroup } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
import { sendParticipantToRoom } from '../../../breakout-rooms/actions';
+import { IRoom } from '../../../breakout-rooms/types';
-type Props = {
+interface IProps {
/**
* Click handler.
*/
- onClick: ?Function,
+ onClick?: Function;
/**
* The ID for the participant on which the button will act.
*/
- participantID: string,
+ participantID: string;
/**
* The room to send the participant to.
*/
- room: Object
+ room: IRoom;
}
-const SendToRoomButton = ({ onClick, participantID, room }: Props) => {
+const SendToRoomButton = ({ onClick, participantID, room }: IProps) => {
const dispatch = useDispatch();
const { t } = useTranslation();
const _onClick = useCallback(() => {
- onClick && onClick();
+ onClick?.();
sendAnalytics(createBreakoutRoomsEvent('send.participant.to.room'));
dispatch(sendParticipantToRoom(participantID, room.id));
}, [ participantID, room ]);
diff --git a/react/features/video-menu/components/web/TogglePinToStageButton.js b/react/features/video-menu/components/web/TogglePinToStageButton.tsx
similarity index 86%
rename from react/features/video-menu/components/web/TogglePinToStageButton.js
rename to react/features/video-menu/components/web/TogglePinToStageButton.tsx
index 6d3fa34636..ac30ead758 100644
--- a/react/features/video-menu/components/web/TogglePinToStageButton.js
+++ b/react/features/video-menu/components/web/TogglePinToStageButton.tsx
@@ -1,45 +1,43 @@
-// @flow
-
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
-import { IconPin, IconPinned } from '../../../base/icons';
+import { IconPin, IconPinned } from '../../../base/icons/svg';
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
import { togglePinStageParticipant } from '../../../filmstrip/actions.web';
import { getPinnedActiveParticipants } from '../../../filmstrip/functions.web';
-type Props = {
+interface IProps {
/**
* Button text class name.
*/
- className: string,
+ className?: string;
/**
* Whether the icon should be hidden or not.
*/
- noIcon: boolean,
+ noIcon?: boolean;
/**
* Click handler executed aside from the main action.
*/
- onClick?: Function,
+ onClick?: Function;
/**
* The ID for the participant on which the button will act.
*/
- participantID: string
+ participantID: string;
}
-const TogglePinToStageButton = ({ className, noIcon = false, onClick, participantID }: Props) => {
+const TogglePinToStageButton = ({ className, noIcon = false, onClick, participantID }: IProps) => {
const dispatch = useDispatch();
const { t } = useTranslation();
const isActive = Boolean(useSelector(getPinnedActiveParticipants)
.find(p => p.participantId === participantID));
const _onClick = useCallback(() => {
dispatch(togglePinStageParticipant(participantID));
- onClick && onClick();
+ onClick?.();
}, [ participantID, isActive ]);
const text = isActive
diff --git a/react/features/video-menu/components/web/index.ts b/react/features/video-menu/components/web/index.ts
index 2ba2bfac38..d1d5e7930c 100644
--- a/react/features/video-menu/components/web/index.ts
+++ b/react/features/video-menu/components/web/index.ts
@@ -1,30 +1,5 @@
-/* eslint-disable lines-around-comment */
-export { default as AskToUnmuteButton } from './AskToUnmuteButton';
-// @ts-ignore
-export { default as ConnectionStatusButton } from './ConnectionStatusButton';
-// @ts-ignore
-export { default as GrantModeratorButton } from './GrantModeratorButton';
export { default as GrantModeratorDialog } from './GrantModeratorDialog';
-// @ts-ignore
-export { default as KickButton } from './KickButton';
export { default as KickRemoteParticipantDialog } from './KickRemoteParticipantDialog';
-// @ts-ignore
-export { default as MuteButton } from './MuteButton';
-// @ts-ignore
-export { default as MuteVideoButton } from './MuteVideoButton';
export { default as MuteEveryoneDialog } from './MuteEveryoneDialog';
export { default as MuteEveryonesVideoDialog } from './MuteEveryonesVideoDialog';
-// @ts-ignore
-export { default as MuteEveryoneElseButton } from './MuteEveryoneElseButton';
-// @ts-ignore
-export { default as MuteEveryoneElsesVideoButton } from './MuteEveryoneElsesVideoButton';
export { default as MuteRemoteParticipantsVideoDialog } from './MuteRemoteParticipantsVideoDialog';
-// @ts-ignore
-export { default as TogglePinToStageButton } from './TogglePinToStageButton';
-// @ts-ignore
-export { default as PrivateMessageMenuButton } from './PrivateMessageMenuButton';
-// @ts-ignore
-export { REMOTE_CONTROL_MENU_STATES, default as RemoteControlButton } from './RemoteControlButton';
-export { default as RemoteVideoMenuTriggerButton } from './RemoteVideoMenuTriggerButton';
-export { default as LocalVideoMenuTriggerButton } from './LocalVideoMenuTriggerButton';
-export { default as VolumeSlider } from './VolumeSlider';
diff --git a/react/features/video-quality/components/VideoQualityButton.web.js b/react/features/video-quality/components/VideoQualityButton.web.ts
similarity index 63%
rename from react/features/video-quality/components/VideoQualityButton.web.js
rename to react/features/video-quality/components/VideoQualityButton.web.ts
index 8dbbb8735d..b9ee411a2e 100644
--- a/react/features/video-quality/components/VideoQualityButton.web.js
+++ b/react/features/video-quality/components/VideoQualityButton.web.ts
@@ -1,31 +1,24 @@
-// @flow
-
-import { translate } from '../../base/i18n';
-import { IconPerformance } from '../../base/icons';
-import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
+import { translate } from '../../base/i18n/functions';
+import { IconPerformance } from '../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
/**
* The type of the React {@code Component} props of
* {@link VideoQualityButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* Whether or not audio only mode is currently enabled.
*/
- _audioOnly: boolean,
+ _audioOnly: boolean;
/**
* The currently configured maximum quality resolution to be received from
* and sent to remote participants.
*/
- _videoQuality: number,
-
- /**
- * Invoked to obtain translated strings.
- */
- t: Function
-};
+ _videoQuality: number;
+}
/**
* React {@code Component} responsible for displaying a button in the overflow
@@ -34,7 +27,7 @@ type Props = AbstractButtonProps & {
*
* @augments Component
*/
-class VideoQualityButton extends AbstractButton<Props, *> {
+class VideoQualityButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.callQuality';
label = 'videoStatus.performanceSettings';
tooltip = 'videoStatus.performanceSettings';
diff --git a/react/features/video-quality/components/VideoQualityDialog.web.js b/react/features/video-quality/components/VideoQualityDialog.web.tsx
similarity index 100%
rename from react/features/video-quality/components/VideoQualityDialog.web.js
rename to react/features/video-quality/components/VideoQualityDialog.web.tsx
diff --git a/react/features/virtual-background/components/VideoBackgroundButton.js b/react/features/virtual-background/components/VideoBackgroundButton.ts
similarity index 77%
rename from react/features/virtual-background/components/VideoBackgroundButton.js
rename to react/features/virtual-background/components/VideoBackgroundButton.ts
index d49bcd0350..1f7862016b 100644
--- a/react/features/virtual-background/components/VideoBackgroundButton.js
+++ b/react/features/virtual-background/components/VideoBackgroundButton.ts
@@ -1,11 +1,9 @@
-// @flow
-
import { connect } from 'react-redux';
-import { translate } from '../../base/i18n';
-import { IconImage } from '../../base/icons';
-import { AbstractButton } from '../../base/toolbox/components';
-import type { AbstractButtonProps } from '../../base/toolbox/components';
+import { IReduxState } from '../../app/types';
+import { translate } from '../../base/i18n/functions';
+import { IconImage } from '../../base/icons/svg';
+import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
import { openSettingsDialog } from '../../settings/actions';
import { SETTINGS_TABS } from '../../settings/constants';
import { checkBlurSupport } from '../functions';
@@ -13,23 +11,18 @@ import { checkBlurSupport } from '../functions';
/**
* The type of the React {@code Component} props of {@link VideoBackgroundButton}.
*/
-type Props = AbstractButtonProps & {
+interface IProps extends AbstractButtonProps {
/**
* True if the video background is blurred or false if it is not.
*/
- _isBackgroundEnabled: boolean,
-
- /**
- * The redux {@code dispatch} function.
- */
- dispatch: Function
-};
+ _isBackgroundEnabled: boolean;
+}
/**
* An abstract implementation of a button that toggles the video background dialog.
*/
-class VideoBackgroundButton extends AbstractButton<Props, *> {
+class VideoBackgroundButton extends AbstractButton<IProps> {
accessibilityLabel = 'toolbar.accessibilityLabel.selectBackground';
icon = IconImage;
label = 'toolbar.selectBackground';
@@ -70,7 +63,7 @@ class VideoBackgroundButton extends AbstractButton<Props, *> {
* _isBackgroundEnabled: boolean
* }}
*/
-function _mapStateToProps(state): Object {
+function _mapStateToProps(state: IReduxState) {
return {
_isBackgroundEnabled: Boolean(state['features/virtual-background'].backgroundEffectEnabled),
diff --git a/react/features/welcome/components/TabIcon.js b/react/features/welcome/components/TabIcon.tsx
similarity index 72%
rename from react/features/welcome/components/TabIcon.js
rename to react/features/welcome/components/TabIcon.tsx
index 71ff337f1c..402af6eebd 100644
--- a/react/features/welcome/components/TabIcon.js
+++ b/react/features/welcome/components/TabIcon.tsx
@@ -1,30 +1,28 @@
-// @flow
-
import React from 'react';
-import { Icon } from '../../base/icons';
+import Icon from '../../base/icons/components/Icon';
import BaseTheme from '../../base/ui/components/BaseTheme';
import { INACTIVE_TAB_COLOR } from '../constants';
-type Props = {
+interface IProps {
/**
* Is the tab focused?
*/
- focused?: boolean,
+ focused?: boolean;
/**
* The ImageSource to be rendered as image.
*/
- src: Object,
+ src: Function;
/**
* The component's external style.
*/
- style?: Object
+ style?: Object;
}
-const TabIcon = ({ focused, src, style }: Props) => (
+const TabIcon = ({ focused, src, style }: IProps) => (
<Icon
color = { focused ? BaseTheme.palette.icon01 : INACTIVE_TAB_COLOR }
size = { 24 }
diff --git a/react/features/welcome/constants.tsx b/react/features/welcome/constants.tsx
index 436fd1f713..a8586c6452 100644
--- a/react/features/welcome/constants.tsx
+++ b/react/features/welcome/constants.tsx
@@ -3,7 +3,6 @@ import React from 'react';
import { IconCalendar, IconGear, IconRestore } from '../base/icons/svg';
import BaseTheme from '../base/ui/components/BaseTheme';
-// @ts-ignore
import TabIcon from './components/TabIcon';
export const ACTIVE_TAB_COLOR = BaseTheme.palette.icon01;