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(toolbar) Move getButtons to functions (#13502)

Robert Pintilii2d8014775a34
diff --git a/react/features/chat/components/web/ChatButton.tsx b/react/features/chat/components/web/ChatButton.tsx
index d7fbf2ed54..62466fe5a4 100644
--- a/react/features/chat/components/web/ChatButton.tsx
+++ b/react/features/chat/components/web/ChatButton.tsx
@@ -1,10 +1,14 @@
import React from 'react';
import { connect } from 'react-redux';
+import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
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 { closeOverflowMenuIfOpen } from '../../../toolbox/actions.web';
+import { toggleChat } from '../../actions.web';
import ChatCounter from './ChatCounter';
@@ -59,6 +63,24 @@ class ChatButton extends AbstractButton<IProps> {
</div>
);
}
+
+ /**
+ * Handles clicking the button, and toggles the chat.
+ *
+ * @private
+ * @returns {void}
+ */
+ _handleClick() {
+ const { dispatch } = this.props;
+
+ sendAnalytics(createToolbarEvent(
+ 'toggle.chat',
+ {
+ enable: !this.props._chatOpen
+ }));
+ dispatch(closeOverflowMenuIfOpen());
+ dispatch(toggleChat());
+ }
}
/**
diff --git a/react/features/embed-meeting/components/EmbedMeetingButton.ts b/react/features/embed-meeting/components/EmbedMeetingButton.ts
index 70c6942103..469d293664 100644
--- a/react/features/embed-meeting/components/EmbedMeetingButton.ts
+++ b/react/features/embed-meeting/components/EmbedMeetingButton.ts
@@ -2,10 +2,13 @@ import { connect } from 'react-redux';
import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../analytics/functions';
+import { IReduxState } from '../../app/types';
import { openDialog } from '../../base/dialog/actions';
+import { isMobileBrowser } from '../../base/environment/utils';
import { translate } from '../../base/i18n/functions';
import { IconCode } from '../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
+import { isVpaasMeeting } from '../../jaas/functions';
import EmbedMeetingDialog from './EmbedMeetingDialog';
@@ -32,4 +35,16 @@ class EmbedMeetingButton extends AbstractButton<AbstractButtonProps> {
}
}
-export default translate(connect()(EmbedMeetingButton));
+/**
+ * Function that maps parts of Redux state tree into component props.
+ *
+ * @param {Object} state - Redux state.
+ * @returns {Object}
+ */
+const mapStateToProps = (state: IReduxState) => {
+ return {
+ visible: !isVpaasMeeting(state) && !isMobileBrowser()
+ };
+};
+
+export default translate(connect(mapStateToProps)(EmbedMeetingButton));
diff --git a/react/features/feedback/components/FeedbackButton.web.ts b/react/features/feedback/components/FeedbackButton.web.ts
index 832da5b968..32ab6aad0f 100644
--- a/react/features/feedback/components/FeedbackButton.web.ts
+++ b/react/features/feedback/components/FeedbackButton.web.ts
@@ -45,8 +45,11 @@ class FeedbackButton extends AbstractButton<IProps> {
}
const mapStateToProps = (state: IReduxState) => {
+ const { callStatsID } = state['features/base/config'];
+
return {
- _conference: state['features/base/conference'].conference
+ _conference: state['features/base/conference'].conference,
+ visible: Boolean(callStatsID)
};
};
diff --git a/react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.ts b/react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.ts
index 19b67ebcd0..87c5996b04 100644
--- a/react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.ts
+++ b/react/features/keyboard-shortcuts/components/web/KeyboardShortcutsButton.ts
@@ -2,11 +2,14 @@ import { connect } from 'react-redux';
import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
+import { IReduxState } from '../../../app/types';
+import { isMobileBrowser } from '../../../base/environment/utils';
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';
+import { areKeyboardShortcutsEnabled } from '../../functions';
/**
* Implementation of a button for opening keyboard shortcuts dialog.
@@ -31,4 +34,16 @@ class KeyboardShortcutsButton extends AbstractButton<AbstractButtonProps> {
}
}
-export default translate(connect()(KeyboardShortcutsButton));
+/**
+ * Function that maps parts of Redux state tree into component props.
+ *
+ * @param {Object} state - Redux state.
+ * @returns {Object}
+ */
+const mapStateToProps = (state: IReduxState) => {
+ return {
+ visible: !isMobileBrowser() && areKeyboardShortcutsEnabled(state)
+ };
+};
+
+export default translate(connect(mapStateToProps)(KeyboardShortcutsButton));
diff --git a/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx b/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx
index c7b318deb5..43ecabf895 100644
--- a/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx
+++ b/react/features/participants-pane/components/web/ParticipantsPaneButton.tsx
@@ -5,6 +5,10 @@ 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 {
+ close as closeParticipantsPane,
+ open as openParticipantsPane
+} from '../../../participants-pane/actions.web';
import ParticipantsCounter from './ParticipantsCounter';
@@ -41,6 +45,22 @@ class ParticipantsPaneButton extends AbstractButton<IProps> {
return this.props._isOpen;
}
+ /**
+ * Handles clicking the button, and toggles the participants pane.
+ *
+ * @private
+ * @returns {void}
+ */
+ _handleClick() {
+ const { dispatch, _isOpen } = this.props;
+
+ if (_isOpen) {
+ dispatch(closeParticipantsPane());
+ } else {
+ dispatch(openParticipantsPane());
+ }
+ }
+
/**
* Overrides AbstractButton's {@link Component#render()}.
*
diff --git a/react/features/reactions/components/web/RaiseHandButton.ts b/react/features/reactions/components/web/RaiseHandButton.ts
index a84e257b30..f4dd2fd42e 100644
--- a/react/features/reactions/components/web/RaiseHandButton.ts
+++ b/react/features/reactions/components/web/RaiseHandButton.ts
@@ -1,8 +1,11 @@
import { connect } from 'react-redux';
+import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import { IconRaiseHand } from '../../../base/icons/svg';
+import { raiseHand } from '../../../base/participants/actions';
import { getLocalParticipant, hasRaisedHand } from '../../../base/participants/functions';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
@@ -40,6 +43,22 @@ class RaiseHandButton extends AbstractButton<IProps> {
_isToggled() {
return this.props.raisedHand;
}
+
+ /**
+ * Handles clicking the button, and toggles the raise hand.
+ *
+ * @private
+ * @returns {void}
+ */
+ _handleClick() {
+ const { dispatch, raisedHand } = this.props;
+
+ sendAnalytics(createToolbarEvent(
+ 'raise.hand',
+ { enable: !raisedHand }));
+
+ dispatch(raiseHand(!raisedHand));
+ }
}
diff --git a/react/features/reactions/components/web/RaiseHandContainerButtons.tsx b/react/features/reactions/components/web/RaiseHandContainerButtons.tsx
new file mode 100644
index 0000000000..905f2e033c
--- /dev/null
+++ b/react/features/reactions/components/web/RaiseHandContainerButtons.tsx
@@ -0,0 +1,26 @@
+import React from 'react';
+import { useSelector } from 'react-redux';
+
+import { IReduxState } from '../../../app/types';
+import { isMobileBrowser } from '../../../base/environment/utils';
+import { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
+import { isReactionsButtonEnabled, isReactionsEnabled } from '../../functions.web';
+
+import RaiseHandButton from './RaiseHandButton';
+import ReactionsMenuButton from './ReactionsMenuButton';
+
+const RaiseHandContainerButton = (props: AbstractButtonProps) => {
+ const reactionsButtonEnabled = useSelector(isReactionsButtonEnabled);
+ const reactionsEnabled = useSelector(isReactionsEnabled);
+ const isNarrowLayout = useSelector((state: IReduxState) => state['features/base/responsive-ui'].isNarrowLayout);
+ const showReactionsAsPartOfRaiseHand
+ = !reactionsButtonEnabled && reactionsEnabled && !isNarrowLayout && !isMobileBrowser();
+
+ return showReactionsAsPartOfRaiseHand
+ ? <ReactionsMenuButton
+ { ...props }
+ showRaiseHand = { true } />
+ : <RaiseHandButton { ...props } />;
+};
+
+export default RaiseHandContainerButton;
diff --git a/react/features/reactions/components/web/ReactionsMenuButton.tsx b/react/features/reactions/components/web/ReactionsMenuButton.tsx
index 2a9e289930..1d98026dfa 100644
--- a/react/features/reactions/components/web/ReactionsMenuButton.tsx
+++ b/react/features/reactions/components/web/ReactionsMenuButton.tsx
@@ -1,11 +1,15 @@
-import React, { ReactElement, useCallback } from 'react';
+import React, { ReactElement, useCallback, useMemo } from 'react';
import { WithTranslation } from 'react-i18next';
-import { connect } from 'react-redux';
+import { connect, useSelector } from 'react-redux';
+import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
import { IReduxState, IStore } from '../../../app/types';
import { isMobileBrowser } from '../../../base/environment/utils';
import { translate } from '../../../base/i18n/functions';
import { IconArrowUp, IconFaceSmile } from '../../../base/icons/svg';
+import { raiseHand } from '../../../base/participants/actions';
+import { getLocalParticipant, hasRaisedHand } from '../../../base/participants/functions';
import AbstractButton, { type IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import ToolboxButtonWithPopup from '../../../base/toolbox/components/web/ToolboxButtonWithPopup';
import { toggleReactionsMenuVisibility } from '../../actions.web';
@@ -30,6 +34,11 @@ interface IProps extends WithTranslation {
*/
_reactionsButtonEnabled: boolean;
+ /**
+ * Whether or not the reactions are enabled.
+ */
+ _reactionsEnabled: boolean;
+
/**
* The button's key.
*/
@@ -40,11 +49,6 @@ interface IProps extends WithTranslation {
*/
dispatch: IStore['dispatch'];
- /**
- * Click handler for raise hand functionality.
- */
- handleClick: Function;
-
/**
* Whether or not it's narrow mode or mobile browser.
*/
@@ -65,6 +69,11 @@ interface IProps extends WithTranslation {
* The array of reactions to be displayed.
*/
reactionsQueue: Array<IReactionEmojiProps>;
+
+ /**
+ * Whether or not to show the raise hand button.
+ */
+ showRaiseHand?: boolean;
}
@@ -88,14 +97,15 @@ const ReactionsButton = translate(connect()(ReactionsButtonImpl));
*/
function ReactionsMenuButton({
_reactionsButtonEnabled,
+ _reactionsEnabled,
_isMobile,
buttonKey,
dispatch,
- handleClick,
isOpen,
isNarrow,
notifyMode,
reactionsQueue,
+ showRaiseHand,
t
}: IProps) {
const toggleReactionsMenu = useCallback(() => {
@@ -110,26 +120,27 @@ function ReactionsMenuButton({
isOpen && toggleReactionsMenu();
}, [ isOpen, toggleReactionsMenu ]);
+ const localParticipant = useSelector(getLocalParticipant);
+ const raisedHand = useMemo(() => hasRaisedHand(localParticipant), [ localParticipant ]);
+ const handleClick = useCallback(() => {
+ sendAnalytics(createToolbarEvent(
+ 'raise.hand',
+ { enable: !raisedHand }));
+
+ dispatch(raiseHand(!raisedHand));
+ }, [ raisedHand ]);
+
+ if (!showRaiseHand && (!_reactionsButtonEnabled || !_reactionsEnabled)) {
+ return null;
+ }
+
const reactionsMenu = (<div className = 'reactions-menu-container'>
<ReactionsMenu parent = { IReactionsMenuParent.Button } />
</div>);
let content: ReactElement | null = null;
- if (_reactionsButtonEnabled) {
- content = (
- <ToolboxButtonWithPopup
- ariaLabel = { t('toolbar.accessibilityLabel.reactionsMenu') }
- onPopoverClose = { closeReactionsMenu }
- onPopoverOpen = { openReactionsMenu }
- popoverContent = { reactionsMenu }
- trigger = { _isMobile ? 'click' : undefined }
- visible = { isOpen }>
- <ReactionsButton
- buttonKey = { buttonKey }
- notifyMode = { notifyMode } />
- </ToolboxButtonWithPopup>);
- } else {
+ if (showRaiseHand) {
content = isNarrow
? (
<RaiseHandButton
@@ -150,6 +161,19 @@ function ReactionsMenuButton({
handleClick = { handleClick }
notifyMode = { notifyMode } />
</ToolboxButtonWithPopup>);
+ } else {
+ content = (
+ <ToolboxButtonWithPopup
+ ariaLabel = { t('toolbar.accessibilityLabel.reactionsMenu') }
+ onPopoverClose = { closeReactionsMenu }
+ onPopoverOpen = { openReactionsMenu }
+ popoverContent = { reactionsMenu }
+ trigger = { _isMobile ? 'click' : undefined }
+ visible = { isOpen }>
+ <ReactionsButton
+ buttonKey = { buttonKey }
+ notifyMode = { notifyMode } />
+ </ToolboxButtonWithPopup>);
}
return (
diff --git a/react/features/screen-share/components/web/ShareAudioButton.ts b/react/features/screen-share/components/web/ShareAudioButton.ts
index 25256f05b3..3531f8ebe7 100644
--- a/react/features/screen-share/components/web/ShareAudioButton.ts
+++ b/react/features/screen-share/components/web/ShareAudioButton.ts
@@ -3,10 +3,11 @@ import { connect } from 'react-redux';
import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import { IconVolumeOff, IconVolumeUp } from '../../../base/icons/svg';
+import JitsiMeetJS from '../../../base/lib-jitsi-meet';
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';
+import { isAudioOnlySharing, isScreenAudioSupported } from '../../functions';
interface IProps extends AbstractButtonProps {
@@ -62,7 +63,8 @@ class ShareAudioButton extends AbstractButton<IProps> {
function _mapStateToProps(state: IReduxState) {
return {
- _isAudioOnlySharing: Boolean(isAudioOnlySharing(state))
+ _isAudioOnlySharing: Boolean(isAudioOnlySharing(state)),
+ visible: JitsiMeetJS.isDesktopSharingEnabled() && isScreenAudioSupported()
};
}
diff --git a/react/features/speaker-stats/components/web/SpeakerStatsButton.tsx b/react/features/speaker-stats/components/web/SpeakerStatsButton.tsx
index e3cfc23e4e..2e36065d16 100644
--- a/react/features/speaker-stats/components/web/SpeakerStatsButton.tsx
+++ b/react/features/speaker-stats/components/web/SpeakerStatsButton.tsx
@@ -2,8 +2,10 @@ import { connect } from 'react-redux';
import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
+import { IReduxState } from '../../../app/types';
import { openDialog } from '../../../base/dialog/actions';
import { translate } from '../../../base/i18n/functions';
+import { isSpeakerStatsDisabled } from '../../functions';
import AbstractSpeakerStatsButton from '../AbstractSpeakerStatsButton';
import SpeakerStats from './SpeakerStats';
@@ -28,4 +30,16 @@ class SpeakerStatsButton extends AbstractSpeakerStatsButton {
}
}
-export default translate(connect()(SpeakerStatsButton));
+/**
+ * Function that maps parts of Redux state tree into component props.
+ *
+ * @param {Object} state - Redux state.
+ * @returns {Object}
+ */
+const mapStateToProps = (state: IReduxState) => {
+ return {
+ visible: !isSpeakerStatsDisabled(state)
+ };
+};
+
+export default translate(connect(mapStateToProps)(SpeakerStatsButton));
diff --git a/react/features/toolbox/actions.web.ts b/react/features/toolbox/actions.web.ts
index 30d8a1614a..7d94aca839 100644
--- a/react/features/toolbox/actions.web.ts
+++ b/react/features/toolbox/actions.web.ts
@@ -264,3 +264,17 @@ export function setToolboxTimeout(handler: Function, timeoutMS: number) {
});
};
}
+
+/**
+ * Closes the overflow menu if opened.
+ *
+ * @private
+ * @returns {void}
+ */
+export function closeOverflowMenuIfOpen() {
+ return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
+ const { overflowMenuVisible } = getState()['features/toolbox'];
+
+ overflowMenuVisible && dispatch(setOverflowMenuVisible(false));
+ };
+}
diff --git a/react/features/toolbox/components/web/FullscreenButton.ts b/react/features/toolbox/components/web/FullscreenButton.ts
index 7f3729d88b..699c93db47 100644
--- a/react/features/toolbox/components/web/FullscreenButton.ts
+++ b/react/features/toolbox/components/web/FullscreenButton.ts
@@ -1,9 +1,13 @@
import { connect } from 'react-redux';
+import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
import { IReduxState } from '../../../app/types';
+import { isIosMobileBrowser } from '../../../base/environment/utils';
import { translate } from '../../../base/i18n/functions';
import { IconEnterFullscreen, IconExitFullscreen } from '../../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
+import { closeOverflowMenuIfOpen, setFullScreen } from '../../actions.web';
interface IProps extends AbstractButtonProps {
@@ -36,6 +40,25 @@ class FullscreenButton extends AbstractButton<IProps> {
_isToggled() {
return this.props._fullScreen;
}
+
+ /**
+ * Handles clicking the button, and toggles fullscreen.
+ *
+ * @private
+ * @returns {void}
+ */
+ _handleClick() {
+ const { dispatch, _fullScreen } = this.props;
+
+ sendAnalytics(createToolbarEvent(
+ 'toggle.fullscreen',
+ {
+ enable: !_fullScreen
+ }));
+ dispatch(closeOverflowMenuIfOpen());
+
+ dispatch(setFullScreen(!_fullScreen));
+ }
}
/**
@@ -46,7 +69,8 @@ class FullscreenButton extends AbstractButton<IProps> {
*/
const mapStateToProps = (state: IReduxState) => {
return {
- _fullScreen: state['features/toolbox'].fullScreen
+ _fullScreen: state['features/toolbox'].fullScreen,
+ visible: !isIosMobileBrowser()
};
};
diff --git a/react/features/toolbox/components/web/LinkToSalesforceButton.ts b/react/features/toolbox/components/web/LinkToSalesforceButton.ts
index 5065435882..46fe10df9b 100644
--- a/react/features/toolbox/components/web/LinkToSalesforceButton.ts
+++ b/react/features/toolbox/components/web/LinkToSalesforceButton.ts
@@ -2,11 +2,13 @@ import { connect } from 'react-redux';
import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
+import { IReduxState } from '../../../app/types';
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';
import SalesforceLinkDialog from '../../../salesforce/components/web/SalesforceLinkDialog';
+import { isSalesforceEnabled } from '../../../salesforce/functions';
/**
* Implementation of a button for opening the Salesforce link dialog.
@@ -31,4 +33,16 @@ class LinkToSalesforce extends AbstractButton<AbstractButtonProps> {
}
}
-export default translate(connect()(LinkToSalesforce));
+/**
+ * Function that maps parts of Redux state tree into component props.
+ *
+ * @param {Object} state - Redux state.
+ * @returns {Object}
+ */
+const mapStateToProps = (state: IReduxState) => {
+ return {
+ visible: isSalesforceEnabled(state)
+ };
+};
+
+export default translate(connect(mapStateToProps)(LinkToSalesforce));
diff --git a/react/features/toolbox/components/web/ProfileButton.ts b/react/features/toolbox/components/web/ProfileButton.ts
index dc7e3c69ff..aea70b8b98 100644
--- a/react/features/toolbox/components/web/ProfileButton.ts
+++ b/react/features/toolbox/components/web/ProfileButton.ts
@@ -103,13 +103,14 @@ class ProfileButton extends AbstractButton<IProps> {
* @returns {Object}
*/
const mapStateToProps = (state: IReduxState) => {
- const { defaultLocalDisplayName } = state['features/base/config'];
+ const { defaultLocalDisplayName, disableProfile } = state['features/base/config'];
return {
_defaultLocalDisplayName: defaultLocalDisplayName ?? '',
_localParticipant: getLocalParticipant(state),
_unclickable: !interfaceConfig.SETTINGS_SECTIONS.includes('profile'),
- customClass: 'profile-button-avatar'
+ customClass: 'profile-button-avatar',
+ visible: !disableProfile
};
};
diff --git a/react/features/toolbox/components/web/ShareDesktopButton.ts b/react/features/toolbox/components/web/ShareDesktopButton.ts
index 3b286dad5a..5b5b0a995b 100644
--- a/react/features/toolbox/components/web/ShareDesktopButton.ts
+++ b/react/features/toolbox/components/web/ShareDesktopButton.ts
@@ -1,11 +1,15 @@
import { connect } from 'react-redux';
+import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../../analytics/functions';
import { IReduxState } from '../../../app/types';
import { translate } from '../../../base/i18n/functions';
import { IconScreenshare, IconStopScreenshare } from '../../../base/icons/svg';
import JitsiMeetJS from '../../../base/lib-jitsi-meet/_';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
+import { startScreenShareFlow } from '../../../screen-share/actions.web';
import { isScreenVideoShared } from '../../../screen-share/functions';
+import { closeOverflowMenuIfOpen } from '../../actions.web';
import { isDesktopShareButtonDisabled } from '../../functions';
interface IProps extends AbstractButtonProps {
@@ -72,6 +76,23 @@ class ShareDesktopButton extends AbstractButton<IProps> {
_isDisabled() {
return !this.props._desktopSharingEnabled;
}
+
+ /**
+ * Handles clicking the button, and toggles the chat.
+ *
+ * @private
+ * @returns {void}
+ */
+ _handleClick() {
+ const { dispatch, _screensharing } = this.props;
+
+ sendAnalytics(createToolbarEvent(
+ 'toggle.screen.sharing',
+ { enable: !_screensharing }));
+
+ dispatch(closeOverflowMenuIfOpen());
+ dispatch(startScreenShareFlow(!_screensharing));
+ }
}
/**
@@ -88,7 +109,8 @@ const mapStateToProps = (state: IReduxState) => {
return {
_desktopSharingEnabled: desktopSharingEnabled,
- _screensharing: isScreenVideoShared(state)
+ _screensharing: isScreenVideoShared(state),
+ visible: JitsiMeetJS.isDesktopSharingEnabled()
};
};
diff --git a/react/features/toolbox/components/web/Toolbox.tsx b/react/features/toolbox/components/web/Toolbox.tsx
index fb7a1f6124..a08ea05136 100644
--- a/react/features/toolbox/components/web/Toolbox.tsx
+++ b/react/features/toolbox/components/web/Toolbox.tsx
@@ -5,19 +5,17 @@ import { WithTranslation } from 'react-i18next';
import { batch, connect } from 'react-redux';
import { isSpeakerStatsDisabled } from '../../../../features/speaker-stats/functions';
-import { ACTION_SHORTCUT_TRIGGERED, createShortcutEvent, createToolbarEvent } from '../../../analytics/AnalyticsEvents';
+import { ACTION_SHORTCUT_TRIGGERED, createShortcutEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
import { IReduxState, IStore } from '../../../app/types';
-import { IJitsiConference } from '../../../base/conference/reducer';
import { VISITORS_MODE_BUTTONS } from '../../../base/config/constants';
import {
getButtonsWithNotifyClick,
- getMultipleVideoSendingSupportFeatureFlag,
getToolbarButtons,
isToolbarButtonEnabled
} from '../../../base/config/functions.web';
-import { openDialog, toggleDialog } from '../../../base/dialog/actions';
-import { isIosMobileBrowser, isMobileBrowser } from '../../../base/environment/utils';
+import { toggleDialog } from '../../../base/dialog/actions';
+import { isMobileBrowser } from '../../../base/environment/utils';
import { translate } from '../../../base/i18n/functions';
import JitsiMeetJS from '../../../base/lib-jitsi-meet';
import {
@@ -28,62 +26,33 @@ import {
hasRaisedHand,
isLocalParticipantModerator
} from '../../../base/participants/functions';
-import { getLocalVideoTrack } from '../../../base/tracks/functions.web';
-import { ITrack } from '../../../base/tracks/types';
import ContextMenu from '../../../base/ui/components/web/ContextMenu';
import { toggleChat } from '../../../chat/actions.web';
-import ChatButton from '../../../chat/components/web/ChatButton';
-import EmbedMeetingButton from '../../../embed-meeting/components/EmbedMeetingButton';
-import SharedDocumentButton from '../../../etherpad/components/SharedDocumentButton.web';
-import FeedbackButton from '../../../feedback/components/FeedbackButton.web';
import { setGifMenuVisibility } from '../../../gifs/actions';
import { isGifEnabled } from '../../../gifs/functions.web';
-import InviteButton from '../../../invite/components/add-people-dialog/web/InviteButton';
-import { isVpaasMeeting } from '../../../jaas/functions';
import { registerShortcut, unregisterShortcut } from '../../../keyboard-shortcuts/actions';
-import KeyboardShortcutsButton from '../../../keyboard-shortcuts/components/web/KeyboardShortcutsButton';
-import { areKeyboardShortcutsEnabled } from '../../../keyboard-shortcuts/functions';
-import NoiseSuppressionButton from '../../../noise-suppression/components/NoiseSuppressionButton';
import {
close as closeParticipantsPane,
open as openParticipantsPane
} from '../../../participants-pane/actions.web';
-import ParticipantsPaneButton from '../../../participants-pane/components/web/ParticipantsPaneButton';
import { getParticipantsPaneOpen } from '../../../participants-pane/functions';
import {
addReactionToBuffer,
toggleReactionsMenuVisibility
} from '../../../reactions/actions.web';
-import RaiseHandButton from '../../../reactions/components/web/RaiseHandButton';
-import ReactionsMenuButton from '../../../reactions/components/web/ReactionsMenuButton';
import { REACTIONS } from '../../../reactions/constants';
import { isReactionsButtonEnabled, isReactionsEnabled } from '../../../reactions/functions.web';
-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';
-import ShareAudioButton from '../../../screen-share/components/web/ShareAudioButton';
import {
- isScreenAudioSupported,
isScreenVideoShared
} from '../../../screen-share/functions';
-import SecurityDialogButton from '../../../security/components/security-dialog/web/SecurityDialogButton';
-import SettingsButton from '../../../settings/components/web/SettingsButton';
-import SharedVideoButton from '../../../shared-video/components/web/SharedVideoButton';
import SpeakerStats from '../../../speaker-stats/components/web/SpeakerStats';
-import SpeakerStatsButton from '../../../speaker-stats/components/web/SpeakerStatsButton';
-import ClosedCaptionButton from '../../../subtitles/components/web/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.web';
import VideoQualityDialog from '../../../video-quality/components/VideoQualityDialog.web';
-import VideoBackgroundButton from '../../../virtual-background/components/VideoBackgroundButton';
import { iAmVisitor } from '../../../visitors/functions';
-import WhiteboardButton from '../../../whiteboard/components/web/WhiteboardButton';
-import { isWhiteboardButtonVisible } from '../../../whiteboard/functions';
import {
setFullScreen,
setHangupMenuVisible,
@@ -93,38 +62,25 @@ import {
} from '../../actions.web';
import { NOTIFY_CLICK_MODE, NOT_APPLICABLE, THRESHOLDS } from '../../constants';
import {
+ getAllToolboxButtons,
getJwtDisabledButtons,
isDesktopShareButtonDisabled,
isToolboxVisible
} from '../../functions.web';
-import DownloadButton from '../DownloadButton';
+import { IToolboxButton } from '../../types';
import HangupButton from '../HangupButton';
-import HelpButton from '../HelpButton';
-import AudioSettingsButton from './AudioSettingsButton';
-import CustomOptionButton from './CustomOptionButton';
import { EndConferenceButton } from './EndConferenceButton';
-import FullscreenButton from './FullscreenButton';
import HangupMenuButton from './HangupMenuButton';
import { LeaveConferenceButton } from './LeaveConferenceButton';
-import LinkToSalesforceButton from './LinkToSalesforceButton';
import OverflowMenuButton from './OverflowMenuButton';
-import ProfileButton from './ProfileButton';
import Separator from './Separator';
-import ShareDesktopButton from './ShareDesktopButton';
-import ToggleCameraButton from './ToggleCameraButton';
-import VideoSettingsButton from './VideoSettingsButton';
/**
* The type of the React {@code Component} props of {@link Toolbox}.
*/
interface IProps extends WithTranslation {
- /**
- * String showing if the virtual background type is desktop-share.
- */
- _backgroundType: string;
-
/**
* Toolbar buttons which have their click exposed through the API.
*/
@@ -143,11 +99,6 @@ interface IProps extends WithTranslation {
*/
_clientWidth: number;
- /**
- * The {@code JitsiConference} for the current conference.
- */
- _conference?: IJitsiConference;
-
/**
* Custom Toolbar buttons.
*/
@@ -178,11 +129,6 @@ interface IProps extends WithTranslation {
*/
_endConferenceSupported: boolean;
- /**
- * Whether or not call feedback can be sent.
- */
- _feedbackConfigured: boolean;
-
/**
* Whether or not the app is currently in full screen.
*/
@@ -198,16 +144,6 @@ interface IProps extends WithTranslation {
*/
_hangupMenuVisible: boolean;
- /**
- * Whether the app has Salesforce integration.
- */
- _hasSalesforce: boolean;
-
- /**
- * Whether or not the app is running in an ios mobile browser.
- */
- _isIosMobile: boolean;
-
/**
* Whether or not the app is running in mobile browser.
*/
@@ -218,42 +154,16 @@ interface IProps extends WithTranslation {
*/
_isNarrowLayout: boolean;
- /**
- * Whether or not the profile is disabled.
- */
- _isProfileDisabled: boolean;
-
/**
* Whether or not speaker stats is disable.
*/
_isSpeakerStatsDisabled?: boolean;
-
- /**
- * Whether or not the current meeting belongs to a JaaS user.
- */
- _isVpaasMeeting: boolean;
-
/**
* The array of toolbar buttons disabled through jwt features.
*/
_jwtDisabledButons: string[];
- /**
- * The ID of the local participant.
- */
- _localParticipantID?: string;
-
- /**
- * The JitsiLocalTrack to display.
- */
- _localVideo?: ITrack;
-
- /**
- * Whether or not multi-stream send support is enabled.
- */
- _multiStreamModeEnabled: boolean;
-
/**
* Whether or not the overflow menu is displayed in a drawer drawer.
*/
@@ -289,21 +199,11 @@ interface IProps extends WithTranslation {
*/
_screenSharing: boolean;
- /**
- * Whether or not the local participant is sharing a YouTube video.
- */
- _sharingVideo?: boolean;
-
/**
* Whether the toolbox should be shifted up or not.
*/
_shiftUp: boolean;
- /**
- * Whether or not the shortcut buttons are enabled.
- */
- _shortcutsEnabled: boolean;
-
/**
* Whether or not the tile view is enabled.
*/
@@ -314,21 +214,11 @@ interface IProps extends WithTranslation {
*/
_toolbarButtons: Array<string>;
- /**
- * Returns the selected virtual source object.
- */
- _virtualSource: any;
-
/**
* Flag showing whether toolbar is visible.
*/
_visible: boolean;
- /**
- * Whether the whiteboard is visible.
- */
- _whiteboardEnabled: boolean;
-
/**
* An object containing the CSS classes.
*/
@@ -401,12 +291,6 @@ class Toolbox extends Component<IProps> {
this._onShortcutToggleRaiseHand = this._onShortcutToggleRaiseHand.bind(this);
this._onShortcutToggleScreenshare = this._onShortcutToggleScreenshare.bind(this);
this._onShortcutToggleVideoQuality = this._onShortcutToggleVideoQuality.bind(this);
- this._onToolbarToggleParticipantsPane = this._onToolbarToggleParticipantsPane.bind(this);
- this._onToolbarOpenVideoQuality = this._onToolbarOpenVideoQuality.bind(this);
- this._onToolbarToggleChat = this._onToolbarToggleChat.bind(this);
- this._onToolbarToggleFullScreen = this._onToolbarToggleFullScreen.bind(this);
- this._onToolbarToggleRaiseHand = this._onToolbarToggleRaiseHand.bind(this);
- this._onToolbarToggleScreenshare = this._onToolbarToggleScreenshare.bind(this);
this._onShortcutToggleTileView = this._onShortcutToggleTileView.bind(this);
this._onShortcutSpeakerStats = this._onShortcutSpeakerStats.bind(this);
this._onEscKey = this._onEscKey.bind(this);
@@ -555,7 +439,7 @@ class Toolbox extends Component<IProps> {
componentWillUnmount() {
const { dispatch } = this.props;
- [ 'A', 'C', 'D', 'R', 'S' ].forEach(letter =>
+ [ 'A', 'C', 'D', 'P', 'R', 'S', 'W', 'T', 'G' ].forEach(letter =>
dispatch(unregisterShortcut(letter)));
if (this.props._reactionsEnabled) {
@@ -596,396 +480,15 @@ class Toolbox extends Component<IProps> {
* @returns {void}
*/
_onEscKey(e?: React.KeyboardEvent) {
+ const { dispatch, _hangupMenuVisible, _overflowMenuVisible } = this.props;
+
if (e?.key === 'Escape') {
e?.stopPropagation();
- this._closeHangupMenuIfOpen();
- this._closeOverflowMenuIfOpen();
+ _hangupMenuVisible && dispatch(setHangupMenuVisible(false));
+ _overflowMenuVisible && dispatch(setOverflowMenuVisible(false));
}
}
- /**
- * Closes the hangup menu if opened.
- *
- * @private
- * @returns {void}
- */
- _closeHangupMenuIfOpen() {
- const { dispatch, _hangupMenuVisible } = this.props;
-
- _hangupMenuVisible && dispatch(setHangupMenuVisible(false));
- }
-
- /**
- * Closes the overflow menu if opened.
- *
- * @private
- * @returns {void}
- */
- _closeOverflowMenuIfOpen() {
- const { dispatch, _overflowMenuVisible } = this.props;
-
- _overflowMenuVisible && dispatch(setOverflowMenuVisible(false));
- }
-
- /**
- * Dispatches an action to open the video quality dialog.
- *
- * @private
- * @returns {void}
- */
- _doOpenVideoQuality() {
- this.props.dispatch(openDialog(VideoQualityDialog));
- }
-
- /**
- * Dispatches an action to toggle the display of chat.
- *
- * @private
- * @returns {void}
- */
- _doToggleChat() {
- this.props.dispatch(toggleChat());
- }
-
- /**
- * Dispatches an action to toggle screensharing.
- *
- * @private
- * @returns {void}
- */
- _doToggleFullScreen() {
- const fullScreen = !this.props._fullScreen;
-
- this.props.dispatch(setFullScreen(fullScreen));
- }
-
- /**
- * Dispatches an action to toggle the local participant's raised hand state.
- *
- * @private
- * @returns {void}
- */
- _doToggleRaiseHand() {
- const { _raisedHand } = this.props;
-
- this.props.dispatch(raiseHand(!_raisedHand));
- }
-
- /**
- * Dispatches an action to toggle screensharing.
- *
- * @private
- * @param {boolean} enabled - The state to toggle screen sharing to.
- * @param {boolean} audioOnly - Only share system audio.
- * @returns {void}
- */
- _doToggleScreenshare() {
- const {
- _desktopSharingButtonDisabled,
- _desktopSharingEnabled,
- _screenSharing,
- dispatch
- } = this.props;
-
- if (_desktopSharingEnabled && !_desktopSharingButtonDisabled) {
- dispatch(startScreenShareFlow(!_screenSharing));
- }
- }
-
- /**
- * Dispatches an action to toggle the video quality dialog.
- *
- * @private
- * @returns {void}
- */
- _doToggleVideoQuality() {
- this.props.dispatch(toggleDialog(VideoQualityDialog));
- }
-
- /**
- * Dispaches an action to toggle tile view.
- *
- * @private
- * @returns {void}
- */
- _doToggleTileView() {
- this.props.dispatch(toggleTileView());
- }
-
- /**
- * Returns all buttons that could be rendered.
- *
- * @param {Object} state - The redux state.
- * @returns {Object} The button maps mainMenuButtons and overflowMenuButtons.
- */
- _getAllButtons() {
- const {
- _customToolbarButtons,
- _feedbackConfigured,
- _hasSalesforce,
- _isIosMobile,
- _isMobile,
- _isNarrowLayout,
- _isSpeakerStatsDisabled,
- _multiStreamModeEnabled,
- _reactionsButtonEnabled,
- _reactionsEnabled,
- _screenSharing,
- _shortcutsEnabled,
- _whiteboardEnabled
- } = this.props;
-
- const microphone = {
- key: 'microphone',
- Content: AudioSettingsButton,
- group: 0
- };
-
- const camera = {
- key: 'camera',
- Content: VideoSettingsButton,
- group: 0
- };
-
- const profile = this._isProfileVisible() && {
- key: 'profile',
- Content: ProfileButton,
- group: 1
- };
-
- const chat = {
- key: 'chat',
- Content: ChatButton,
- handleClick: this._onToolbarToggleChat,
- group: 2
- };
-
- const desktop = this._showDesktopSharingButton() && {
- key: 'desktop',
- Content: ShareDesktopButton,
- handleClick: this._onToolbarToggleScreenshare,
- group: 2
- };
-
- // In Narrow layout and mobile web we are using drawer for popups and that is why it is better to include
- // all forms of reactions in the overflow menu. Otherwise the toolbox will be hidden and the reactions popup
- // misaligned.
-
- const showReactionsAsPartOfRaiseHand
- = !_reactionsButtonEnabled && _reactionsEnabled && !_isNarrowLayout && !_isMobile;
- const raisehand = {
- key: 'raisehand',
- Content: showReactionsAsPartOfRaiseHand ? ReactionsMenuButton : RaiseHandButton,
- handleClick: this._onToolbarToggleRaiseHand,
- group: 2
- };
-
- const reactions = _reactionsButtonEnabled && _reactionsEnabled && {
- key: 'reactions',
- Content: ReactionsMenuButton,
- handleClick: this._onToolbarToggleRaiseHand,
- group: 2
- };
-
- const participants = {
- key: 'participants-pane',
- Content: ParticipantsPaneButton,
- handleClick: this._onToolbarToggleParticipantsPane,
- group: 2
- };
-
- const invite = {
- key: 'invite',
- Content: InviteButton,
- group: 2
- };
-
- const tileview = {
- key: 'tileview',
- Content: TileViewButton,
- group: 2
- };
-
- const toggleCamera = {
- key: 'toggle-camera',
- Content: ToggleCameraButton,
- group: 2
- };
-
- const videoQuality = {
- key: 'videoquality',
- Content: VideoQualityButton,
- handleClick: this._onToolbarOpenVideoQuality,
- group: 2
- };
-
- const fullscreen = !_isIosMobile && {
- key: 'fullscreen',
- Content: FullscreenButton,
- handleClick: this._onToolbarToggleFullScreen,
- group: 2
- };
-
- const security = {
- key: 'security',
- alias: 'info',
- Content: SecurityDialogButton,
- group: 2
- };
-
- const cc = {
- key: 'closedcaptions',
- Content: ClosedCaptionButton,
- group: 2
- };
-
- const recording = {
- key: 'recording',
- Content: RecordButton,
- group: 2
- };
-
- const livestreaming = {
- key: 'livestreaming',
- Content: LiveStreamButton,
- group: 2
- };
-
- const linkToSalesforce = _hasSalesforce && {
- key: 'linktosalesforce',
- Content: LinkToSalesforceButton,
- group: 2
- };
-
- const shareVideo = {
- key: 'sharedvideo',
- Content: SharedVideoButton,
- group: 3
- };
-
- const shareAudio = this._showAudioSharingButton() && {
- key: 'shareaudio',
- Content: ShareAudioButton,
- group: 3
- };
-
- const noiseSuppression = {
- key: 'noisesuppression',
- Content: NoiseSuppressionButton,
- group: 3
- };
-
-
- const whiteboard = _whiteboardEnabled && {
- key: 'whiteboard',
- Content: WhiteboardButton,
- group: 3
- };
-
- const etherpad = {
- key: 'etherpad',
- Content: SharedDocumentButton,
- group: 3
- };
-
- const virtualBackground = (_multiStreamModeEnabled || !_screenSharing) && {
- key: 'select-background',
- Content: VideoBackgroundButton,
- group: 3
- };
-
- const speakerStats = !_isSpeakerStatsDisabled && {
- key: 'stats',
- Content: SpeakerStatsButton,
- group: 3
- };
-
- const settings = {
- key: 'settings',
- Content: SettingsButton,
- group: 4
- };
-
- const shortcuts = !_isMobile && _shortcutsEnabled && {
- key: 'shortcuts',
- Content: KeyboardShortcutsButton,
- group: 4
- };
-
- const embed = this._isEmbedMeetingVisible() && {
- key: 'embedmeeting',
- Content: EmbedMeetingButton,
- group: 4
- };
-
- const feedback = _feedbackConfigured && {
- key: 'feedback',
- Content: FeedbackButton,
- group: 4
- };
-
- const download = {
- key: 'download',
- Content: DownloadButton,
- group: 4
- };
-
- const help = {
- key: 'help',
- Content: HelpButton,
- group: 4
- };
-
- const customButtons = _customToolbarButtons?.reduce((prev, { icon, id, text }) => {
- return {
- ...prev,
- [id]: {
- key: id,
- Content: CustomOptionButton,
- group: 4,
- icon,
- text
- }
- };
- }, {});
-
- return {
- microphone,
- camera,
- profile,
- desktop,
- chat,
- raisehand,
- reactions,
- participants,
- invite,
- tileview,
- toggleCamera,
- videoQuality,
- fullscreen,
- security,
- cc,
- recording,
- livestreaming,
- linkToSalesforce,
- shareVideo,
- shareAudio,
- noiseSuppression,
- whiteboard,
- etherpad,
- virtualBackground,
- speakerStats,
- settings,
- shortcuts,
- embed,
- feedback,
- download,
- help,
- ...customButtons
- };
- }
-
-
/**
* Returns the notify mode of the given toolbox button.
*
@@ -1034,10 +537,11 @@ class Toolbox extends Component<IProps> {
const {
_clientWidth,
_toolbarButtons,
- _jwtDisabledButons
+ _jwtDisabledButons,
+ _customToolbarButtons
} = this.props;
- const buttons = this._getAllButtons();
+ const buttons = getAllToolboxButtons(_customToolbarButtons);
this._setButtonsNotifyClickMode(buttons);
const isHangupVisible = isToolbarButtonEnabled('hangup', _toolbarButtons);
@@ -1049,7 +553,7 @@ class Toolbox extends Component<IProps> {
const filtered = [
...order.map(key => buttons[key as keyof typeof buttons]),
...Object.values(buttons).filter((button, index) => !order.includes(keys[index]))
- ].filter(Boolean).filter(({ key, alias = NOT_APPLICABLE }) =>
+ ].filter(({ key, alias = NOT_APPLICABLE }) =>
!_jwtDisabledButons.includes(key)
&& (isToolbarButtonEnabled(key, _toolbarButtons) || isToolbarButtonEnabled(alias, _toolbarButtons))
);
@@ -1144,7 +648,7 @@ class Toolbox extends Component<IProps> {
return false;
}
- this._doToggleChat();
+ this.props.dispatch(toggleChat());
}
/**
@@ -1155,6 +659,8 @@ class Toolbox extends Component<IProps> {
* @returns {void}
*/
_onShortcutToggleParticipantsPane() {
+ const { dispatch, _participantsPaneOpen } = this.props;
+
sendAnalytics(createShortcutEvent(
'toggle.participants-pane',
ACTION_SHORTCUT_TRIGGERED,
@@ -1162,7 +668,11 @@ class Toolbox extends Component<IProps> {
enable: !this.props._participantsPaneOpen
}));
- this._onToolbarToggleParticipantsPane();
+ if (_participantsPaneOpen) {
+ dispatch(closeParticipantsPane());
+ } else {
+ dispatch(openParticipantsPane());
+ }
}
/**
@@ -1175,7 +685,7 @@ class Toolbox extends Component<IProps> {
_onShortcutToggleVideoQuality() {
sendAnalytics(createShortcutEvent('video.quality'));
- this._doToggleVideoQuality();
+ this.props.dispatch(toggleDialog(VideoQualityDialog));
}
/**
@@ -1192,7 +702,7 @@ class Toolbox extends Component<IProps> {
enable: !this.props._tileViewEnabled
}));
- this._doToggleTileView();
+ this.props.dispatch(toggleTileView());
}
/**
@@ -1203,14 +713,15 @@ class Toolbox extends Component<IProps> {
* @returns {void}
*/
_onShortcutToggleFullScreen() {
+ const { dispatch, _fullScreen } = this.props;
+
sendAnalytics(createShortcutEvent(
'toggle.fullscreen',
ACTION_SHORTCUT_TRIGGERED,
{
- enable: !this.props._fullScreen
+ enable: !_fullScreen
}));
-
- this._doToggleFullScreen();
+ dispatch(setFullScreen(!_fullScreen));
}
/**
@@ -1221,12 +732,14 @@ class Toolbox extends Component<IProps> {
* @returns {void}
*/
_onShortcutToggleRaiseHand() {
+ const { dispatch, _raisedHand } = this.props;
+
sendAnalytics(createShortcutEvent(
'toggle.raise.hand',
ACTION_SHORTCUT_TRIGGERED,
- { enable: !this.props._raisedHand }));
+ { enable: !_raisedHand }));
- this._doToggleRaiseHand();
+ dispatch(raiseHand(!_raisedHand));
}
/**
@@ -1237,18 +750,27 @@ class Toolbox extends Component<IProps> {
* @returns {void}
*/
_onShortcutToggleScreenshare() {
+ const {
+ _desktopSharingButtonDisabled,
+ _desktopSharingEnabled,
+ _screenSharing,
+ dispatch
+ } = this.props;
+
// Ignore the shortcut if the button is disabled.
- if (this.props._desktopSharingButtonDisabled) {
+ if (_desktopSharingButtonDisabled) {
return;
}
sendAnalytics(createShortcutEvent(
'toggle.screen.sharing',
ACTION_SHORTCUT_TRIGGERED,
{
- enable: !this.props._screenSharing
+ enable: !_screenSharing
}));
- this._doToggleScreenshare();
+ if (_desktopSharingEnabled && !_desktopSharingButtonDisabled) {
+ dispatch(startScreenShareFlow(!_screenSharing));
+ }
}
/**
@@ -1259,22 +781,12 @@ class Toolbox extends Component<IProps> {
* @returns {void}
*/
_onShortcutSpeakerStats() {
+ const { dispatch } = this.props;
+
sendAnalytics(createShortcutEvent(
'speaker.stats'
));
- this._doToggleSpekearStats();
- }
-
- /**
- * Dispatches an action to toggle speakerStats.
- *
- * @private
- * @returns {void}
- */
- _doToggleSpekearStats() {
- const { dispatch } = this.props;
-
dispatch(toggleDialog(SpeakerStats, {
conference: APP.conference
}));
@@ -1291,143 +803,6 @@ class Toolbox extends Component<IProps> {
}
}
- /**
- * Dispatches an action for toggling the participants pane.
- *
- * @private
- * @returns {void}
- */
- _onToolbarToggleParticipantsPane() {
- const { dispatch, _participantsPaneOpen } = this.props;
-
- if (_participantsPaneOpen) {
- dispatch(closeParticipantsPane());
- } else {
- dispatch(openParticipantsPane());
- }
- }
-
- /**
- * Creates an analytics toolbar event and dispatches an action for toggling
- * open the video quality dialog.
- *
- * @private
- * @returns {void}
- */
- _onToolbarOpenVideoQuality() {
- sendAnalytics(createToolbarEvent('video.quality'));
-
- this._doOpenVideoQuality();
- }
-
- /**
- * Creates an analytics toolbar event and dispatches an action for toggling
- * the display of chat.
- *
- * @private
- * @returns {void}
- */
- _onToolbarToggleChat() {
- sendAnalytics(createToolbarEvent(
- 'toggle.chat',
- {
- enable: !this.props._chatOpen
- }));
- this._closeOverflowMenuIfOpen();
- this._doToggleChat();
- }
-
- /**
- * Creates an analytics toolbar event and dispatches an action for toggling
- * full screen mode.
- *
- * @private
- * @returns {void}
- */
- _onToolbarToggleFullScreen() {
- sendAnalytics(createToolbarEvent(
- 'toggle.fullscreen',
- {
- enable: !this.props._fullScreen
- }));
- this._closeOverflowMenuIfOpen();
- this._doToggleFullScreen();
- }
-
- /**
- * Creates an analytics toolbar event and dispatches an action for toggling
- * raise hand.
- *
- * @private
- * @returns {void}
- */
- _onToolbarToggleRaiseHand() {
- sendAnalytics(createToolbarEvent(
- 'raise.hand',
- { enable: !this.props._raisedHand }));
-
- this._doToggleRaiseHand();
- }
-
- /**
- * Creates an analytics toolbar event and dispatches an action for toggling
- * screensharing.
- *
- * @private
- * @returns {void}
- */
- _onToolbarToggleScreenshare() {
- sendAnalytics(createToolbarEvent(
- 'toggle.screen.sharing',
- { enable: !this.props._screenSharing }));
-
- this._closeOverflowMenuIfOpen();
- this._doToggleScreenshare();
- }
-
- /**
- * Returns true if the audio sharing button should be visible and
- * false otherwise.
- *
- * @returns {boolean}
- */
- _showAudioSharingButton() {
- const {
- _desktopSharingEnabled
- } = this.props;
-
- return _desktopSharingEnabled && isScreenAudioSupported();
- }
-
- /**
- * Returns true if the desktop sharing button should be visible and
- * false otherwise.
- *
- * @returns {boolean}
- */
- _showDesktopSharingButton() {
- return this.props._desktopSharingEnabled;
- }
-
- /**
- * Returns true if the embed meeting button is visible and false otherwise.
- *
- * @returns {boolean}
- */
- _isEmbedMeetingVisible() {
- return !this.props._isVpaasMeeting
- && !this.props._isMobile;
- }
-
- /**
- * Returns true if the profile button is visible and false otherwise.
- *
- * @returns {boolean}
- */
- _isProfileVisible() {
- return !this.props._isProfileDisabled;
- }
-
/**
* Renders the toolbox content.
*
@@ -1481,7 +856,7 @@ class Toolbox extends Component<IProps> {
{Boolean(overflowMenuButtons.length) && (
<OverflowMenuButton
ariaControls = 'overflow-menu'
- buttons = { overflowMenuButtons.reduce((acc, val) => {
+ buttons = { overflowMenuButtons.reduce<Array<IToolboxButton[]>>((acc, val) => {
if (val.key === 'reactions' && showReactionsInOverflowMenu) {
return acc;
}
@@ -1564,9 +939,7 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
const endConferenceSupported = conference?.isEndConferenceSupported() && isLocalParticipantModerator(state);
const {
- callStatsID,
customToolbarButtons,
- disableProfile,
iAmRecorder,
iAmSipGateway
} = state['features/base/config'];
@@ -1577,7 +950,6 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
overflowDrawer
} = state['features/toolbox'];
const localParticipant = getLocalParticipant(state);
- const localVideo = getLocalVideoTrack(state['features/base/tracks']);
const { clientWidth } = state['features/base/responsive-ui'];
let toolbarButtons = ownProps.toolbarButtons || getToolbarButtons(state);
const _reactionsEnabled = isReactionsEnabled(state);
@@ -1587,32 +959,22 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
}
return {
- _backgroundType: state['features/virtual-background'].backgroundType ?? '',
_buttonsWithNotifyClick: getButtonsWithNotifyClick(state),
_chatOpen: state['features/chat'].isOpen,
_clientWidth: clientWidth,
- _conference: conference,
_customToolbarButtons: customToolbarButtons,
_desktopSharingEnabled: JitsiMeetJS.isDesktopSharingEnabled(),
_desktopSharingButtonDisabled: isDesktopShareButtonDisabled(state),
_dialog: Boolean(state['features/base/dialog'].component),
_disabled: Boolean(iAmRecorder || iAmSipGateway),
_endConferenceSupported: Boolean(endConferenceSupported),
- _feedbackConfigured: Boolean(callStatsID),
_fullScreen: fullScreen,
_gifsEnabled: isGifEnabled(state),
- _isProfileDisabled: Boolean(disableProfile),
- _isIosMobile: isIosMobileBrowser(),
_isMobile: isMobileBrowser(),
_isSpeakerStatsDisabled: isSpeakerStatsDisabled(state),
- _isVpaasMeeting: isVpaasMeeting(state),
_jwtDisabledButons: getJwtDisabledButtons(state),
- _hasSalesforce: isSalesforceEnabled(state),
_hangupMenuVisible: hangupMenuVisible,
_isNarrowLayout: isNarrowLayout,
- _localParticipantID: localParticipant?.id,
- _localVideo: localVideo,
- _multiStreamModeEnabled: getMultipleVideoSendingSupportFeatureFlag(state),
_overflowMenuVisible: overflowMenuVisible,
_overflowDrawer: overflowDrawer,
_participantsPaneOpen: getParticipantsPaneOpen(state),
@@ -1621,12 +983,9 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
_reactionsEnabled,
_screenSharing: isScreenVideoShared(state),
_shiftUp: state['features/toolbox'].shiftUp,
- _shortcutsEnabled: areKeyboardShortcutsEnabled(state),
_tileViewEnabled: shouldDisplayTileView(state),
_toolbarButtons: toolbarButtons,
- _virtualSource: state['features/virtual-background'].virtualSource,
- _visible: isToolboxVisible(state),
- _whiteboardEnabled: isWhiteboardButtonVisible(state)
+ _visible: isToolboxVisible(state)
};
}
diff --git a/react/features/toolbox/functions.web.ts b/react/features/toolbox/functions.web.ts
index f03a7912bf..54454cdc2c 100644
--- a/react/features/toolbox/functions.web.ts
+++ b/react/features/toolbox/functions.web.ts
@@ -4,10 +4,43 @@ import { hasAvailableDevices } from '../base/devices/functions';
import { MEET_FEATURES } from '../base/jwt/constants';
import { isJwtFeatureEnabled } from '../base/jwt/functions';
import { IGUMPendingState } from '../base/media/types';
+import ChatButton from '../chat/components/web/ChatButton';
+import EmbedMeetingButton from '../embed-meeting/components/EmbedMeetingButton';
+import SharedDocumentButton from '../etherpad/components/SharedDocumentButton.web';
+import FeedbackButton from '../feedback/components/FeedbackButton.web';
+import InviteButton from '../invite/components/add-people-dialog/web/InviteButton';
+import KeyboardShortcutsButton from '../keyboard-shortcuts/components/web/KeyboardShortcutsButton';
+import NoiseSuppressionButton from '../noise-suppression/components/NoiseSuppressionButton';
+import ParticipantsPaneButton from '../participants-pane/components/web/ParticipantsPaneButton';
+import RaiseHandContainerButton from '../reactions/components/web/RaiseHandContainerButtons';
+import ReactionsMenuButton from '../reactions/components/web/ReactionsMenuButton';
+import LiveStreamButton from '../recording/components/LiveStream/web/LiveStreamButton';
+import RecordButton from '../recording/components/Recording/web/RecordButton';
+import ShareAudioButton from '../screen-share/components/web/ShareAudioButton';
import { isScreenMediaShared } from '../screen-share/functions';
+import SecurityDialogButton from '../security/components/security-dialog/web/SecurityDialogButton';
+import SettingsButton from '../settings/components/web/SettingsButton';
+import SharedVideoButton from '../shared-video/components/web/SharedVideoButton';
+import SpeakerStatsButton from '../speaker-stats/components/web/SpeakerStatsButton';
+import ClosedCaptionButton from '../subtitles/components/web/ClosedCaptionButton';
+import TileViewButton from '../video-layout/components/TileViewButton';
+import VideoQualityButton from '../video-quality/components/VideoQualityButton.web';
+import VideoBackgroundButton from '../virtual-background/components/VideoBackgroundButton';
+import WhiteboardButton from '../whiteboard/components/web/WhiteboardButton';
import { isWhiteboardVisible } from '../whiteboard/functions';
+import DownloadButton from './components/DownloadButton';
+import HelpButton from './components/HelpButton';
+import AudioSettingsButton from './components/web/AudioSettingsButton';
+import CustomOptionButton from './components/web/CustomOptionButton';
+import FullscreenButton from './components/web/FullscreenButton';
+import LinkToSalesforceButton from './components/web/LinkToSalesforceButton';
+import ProfileButton from './components/web/ProfileButton';
+import ShareDesktopButton from './components/web/ShareDesktopButton';
+import ToggleCameraButton from './components/web/ToggleCameraButton';
+import VideoSettingsButton from './components/web/VideoSettingsButton';
import { TOOLBAR_TIMEOUT } from './constants';
+import { IToolboxButton } from './types';
export * from './functions.any';
@@ -158,3 +191,255 @@ export function getToolbarTimeout(state: IReduxState) {
return toolbarConfig?.timeout || TOOLBAR_TIMEOUT;
}
+
+/**
+ * Returns all buttons that could be rendered.
+ *
+ * @param {Object} _customToolbarButtons - An array containing custom buttons objects.
+ * @returns {Object} The button maps mainMenuButtons and overflowMenuButtons.
+ */
+export function getAllToolboxButtons(_customToolbarButtons?: {
+ icon: string;
+ id: string;
+ text: string;
+ }[]): { [key: string]: IToolboxButton; } {
+
+ const microphone = {
+ key: 'microphone',
+ Content: AudioSettingsButton,
+ group: 0
+ };
+
+ const camera = {
+ key: 'camera',
+ Content: VideoSettingsButton,
+ group: 0
+ };
+
+ const profile = {
+ key: 'profile',
+ Content: ProfileButton,
+ group: 1
+ };
+
+ const chat = {
+ key: 'chat',
+ Content: ChatButton,
+ group: 2
+ };
+
+ const desktop = {
+ key: 'desktop',
+ Content: ShareDesktopButton,
+ group: 2
+ };
+
+ // In Narrow layout and mobile web we are using drawer for popups and that is why it is better to include
+ // all forms of reactions in the overflow menu. Otherwise the toolbox will be hidden and the reactions popup
+ // misaligned.
+ const raisehand = {
+ key: 'raisehand',
+ Content: RaiseHandContainerButton,
+ group: 2
+ };
+
+ const reactions = {
+ key: 'reactions',
+ Content: ReactionsMenuButton,
+ group: 2
+ };
+
+ const participants = {
+ key: 'participants-pane',
+ Content: ParticipantsPaneButton,
+ group: 2
+ };
+
+ const invite = {
+ key: 'invite',
+ Content: InviteButton,
+ group: 2
+ };
+
+ const tileview = {
+ key: 'tileview',
+ Content: TileViewButton,
+ group: 2
+ };
+
+ const toggleCamera = {
+ key: 'toggle-camera',
+ Content: ToggleCameraButton,
+ group: 2
+ };
+
+ const videoQuality = {
+ key: 'videoquality',
+ Content: VideoQualityButton,
+ group: 2
+ };
+
+ const fullscreen = {
+ key: 'fullscreen',
+ Content: FullscreenButton,
+ group: 2
+ };
+
+ const security = {
+ key: 'security',
+ alias: 'info',
+ Content: SecurityDialogButton,
+ group: 2
+ };
+
+ const cc = {
+ key: 'closedcaptions',
+ Content: ClosedCaptionButton,
+ group: 2
+ };
+
+ const recording = {
+ key: 'recording',
+ Content: RecordButton,
+ group: 2
+ };
+
+ const livestreaming = {
+ key: 'livestreaming',
+ Content: LiveStreamButton,
+ group: 2
+ };
+
+ const linkToSalesforce = {
+ key: 'linktosalesforce',
+ Content: LinkToSalesforceButton,
+ group: 2
+ };
+
+ const shareVideo = {
+ key: 'sharedvideo',
+ Content: SharedVideoButton,
+ group: 3
+ };
+
+ const shareAudio = {
+ key: 'shareaudio',
+ Content: ShareAudioButton,
+ group: 3
+ };
+
+ const noiseSuppression = {
+ key: 'noisesuppression',
+ Content: NoiseSuppressionButton,
+ group: 3
+ };
+
+
+ const whiteboard = {
+ key: 'whiteboard',
+ Content: WhiteboardButton,
+ group: 3
+ };
+
+ const etherpad = {
+ key: 'etherpad',
+ Content: SharedDocumentButton,
+ group: 3
+ };
+
+ const virtualBackground = {
+ key: 'select-background',
+ Content: VideoBackgroundButton,
+ group: 3
+ };
+
+ const speakerStats = {
+ key: 'stats',
+ Content: SpeakerStatsButton,
+ group: 3
+ };
+
+ const settings = {
+ key: 'settings',
+ Content: SettingsButton,
+ group: 4
+ };
+
+ const shortcuts = {
+ key: 'shortcuts',
+ Content: KeyboardShortcutsButton,
+ group: 4
+ };
+
+ const embed = {
+ key: 'embedmeeting',
+ Content: EmbedMeetingButton,
+ group: 4
+ };
+
+ const feedback = {
+ key: 'feedback',
+ Content: FeedbackButton,
+ group: 4
+ };
+
+ const download = {
+ key: 'download',
+ Content: DownloadButton,
+ group: 4
+ };
+
+ const help = {
+ key: 'help',
+ Content: HelpButton,
+ group: 4
+ };
+
+ const customButtons = _customToolbarButtons?.reduce((prev, { icon, id, text }) => {
+ return {
+ ...prev,
+ [id]: {
+ key: id,
+ Content: CustomOptionButton,
+ group: 4,
+ icon,
+ text
+ }
+ };
+ }, {});
+
+ return {
+ microphone,
+ camera,
+ profile,
+ desktop,
+ chat,
+ raisehand,
+ reactions,
+ participants,
+ invite,
+ tileview,
+ toggleCamera,
+ videoQuality,
+ fullscreen,
+ security,
+ cc,
+ recording,
+ livestreaming,
+ linkToSalesforce,
+ shareVideo,
+ shareAudio,
+ noiseSuppression,
+ whiteboard,
+ etherpad,
+ virtualBackground,
+ speakerStats,
+ settings,
+ shortcuts,
+ embed,
+ feedback,
+ download,
+ help,
+ ...customButtons
+ };
+}
diff --git a/react/features/toolbox/types.ts b/react/features/toolbox/types.ts
new file mode 100644
index 0000000000..a8e27c4d4b
--- /dev/null
+++ b/react/features/toolbox/types.ts
@@ -0,0 +1,8 @@
+import { ComponentType } from 'react';
+
+export interface IToolboxButton {
+ Content: ComponentType<any>;
+ alias?: string;
+ group: number;
+ key: string;
+}
diff --git a/react/features/video-quality/components/VideoQualityButton.web.ts b/react/features/video-quality/components/VideoQualityButton.web.ts
index b9ee411a2e..85d45080c2 100644
--- a/react/features/video-quality/components/VideoQualityButton.web.ts
+++ b/react/features/video-quality/components/VideoQualityButton.web.ts
@@ -1,7 +1,14 @@
+import { connect } from 'react-redux';
+
+import { createToolbarEvent } from '../../analytics/AnalyticsEvents';
+import { sendAnalytics } from '../../analytics/functions';
+import { openDialog } from '../../base/dialog/actions';
import { translate } from '../../base/i18n/functions';
import { IconPerformance } from '../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
+import VideoQualityDialog from './VideoQualityDialog.web';
+
/**
* The type of the React {@code Component} props of
* {@link VideoQualityButton}.
@@ -32,6 +39,20 @@ class VideoQualityButton extends AbstractButton<IProps> {
label = 'videoStatus.performanceSettings';
tooltip = 'videoStatus.performanceSettings';
icon = IconPerformance;
+
+ /**
+ * Handles clicking the button, and opens the video quality dialog.
+ *
+ * @private
+ * @returns {void}
+ */
+ _handleClick() {
+ const { dispatch } = this.props;
+
+ sendAnalytics(createToolbarEvent('video.quality'));
+
+ dispatch(openDialog(VideoQualityDialog));
+ }
}
-export default translate(VideoQualityButton);
+export default connect()(translate(VideoQualityButton));
diff --git a/react/features/virtual-background/components/VideoBackgroundButton.ts b/react/features/virtual-background/components/VideoBackgroundButton.ts
index 1f7862016b..5828022ff0 100644
--- a/react/features/virtual-background/components/VideoBackgroundButton.ts
+++ b/react/features/virtual-background/components/VideoBackgroundButton.ts
@@ -1,9 +1,11 @@
import { connect } from 'react-redux';
import { IReduxState } from '../../app/types';
+import { getMultipleVideoSendingSupportFeatureFlag } from '../../base/config/functions.any';
import { translate } from '../../base/i18n/functions';
import { IconImage } from '../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../base/toolbox/components/AbstractButton';
+import { isScreenVideoShared } from '../../screen-share/functions';
import { openSettingsDialog } from '../../settings/actions';
import { SETTINGS_TABS } from '../../settings/constants';
import { checkBlurSupport } from '../functions';
@@ -67,7 +69,7 @@ function _mapStateToProps(state: IReduxState) {
return {
_isBackgroundEnabled: Boolean(state['features/virtual-background'].backgroundEffectEnabled),
- visible: checkBlurSupport()
+ visible: checkBlurSupport() && getMultipleVideoSendingSupportFeatureFlag(state) && !isScreenVideoShared(state)
};
}
diff --git a/react/features/whiteboard/components/web/WhiteboardButton.tsx b/react/features/whiteboard/components/web/WhiteboardButton.tsx
index 6ec8b6d0ce..b242db08f1 100644
--- a/react/features/whiteboard/components/web/WhiteboardButton.tsx
+++ b/react/features/whiteboard/components/web/WhiteboardButton.tsx
@@ -6,7 +6,7 @@ import { IconWhiteboard, IconWhiteboardHide } from '../../../base/icons/svg';
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
import { setOverflowMenuVisible } from '../../../toolbox/actions.web';
import { setWhiteboardOpen } from '../../actions';
-import { isWhiteboardVisible } from '../../functions';
+import { isWhiteboardButtonVisible, isWhiteboardVisible } from '../../functions';
interface IProps extends AbstractButtonProps {
@@ -63,7 +63,8 @@ class WhiteboardButton extends AbstractButton<IProps> {
*/
function _mapStateToProps(state: IReduxState) {
return {
- _toggled: isWhiteboardVisible(state)
+ _toggled: isWhiteboardVisible(state),
+ visible: isWhiteboardButtonVisible(state)
};
}