Skip to content

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

feat(reactions): New button for web.

Hristo Terezovf8bd8b616e1c
diff --git a/lang/main.json b/lang/main.json
index d0a762dcb5..0299cf89dc 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -1150,6 +1150,7 @@
"privateMessage": "Send private message",
"profile": "Edit your profile",
"raiseHand": "Raise your hand",
+ "reactions": "Reactions",
"reactionsMenu": "Reactions menu",
"recording": "Toggle recording",
"remoteMute": "Mute participant",
@@ -1247,6 +1248,7 @@
"reactionLike": "Send thumbs up reaction",
"reactionSilence": "Send silence reaction",
"reactionSurprised": "Send surprised reaction",
+ "reactions": "Reactions",
"security": "Security options",
"selectBackground": "Select background",
"shareRoom": "Invite someone",
diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts
index cf59dc0354..d1dc7133a7 100644
--- a/react/features/base/config/configType.ts
+++ b/react/features/base/config/configType.ts
@@ -18,6 +18,7 @@ type ToolbarButtons = 'camera' |
'participants-pane' |
'profile' |
'raisehand' |
+ 'reactions' |
'recording' |
'security' |
'select-background' |
diff --git a/react/features/base/popover/components/Popover.web.tsx b/react/features/base/popover/components/Popover.web.tsx
index 04fefa264d..4b42cf8a47 100644
--- a/react/features/base/popover/components/Popover.web.tsx
+++ b/react/features/base/popover/components/Popover.web.tsx
@@ -304,7 +304,8 @@ class Popover extends Component<IProps, IState> {
&& !this.props.overflowDrawer
&& this._contextMenuRef
&& this._contextMenuRef.contains
- && !this._contextMenuRef.contains(event.target as Node)) {
+ && !this._contextMenuRef.contains(event.target as Node)
+ && !this._containerRef?.current?.contains(event.target as Node)) {
this._onHideDialog();
}
}
diff --git a/react/features/base/toolbox/components/web/ToolboxButtonWithIconPopup.tsx b/react/features/base/toolbox/components/web/ToolboxButtonWithPopup.tsx
similarity index 77%
rename from react/features/base/toolbox/components/web/ToolboxButtonWithIconPopup.tsx
rename to react/features/base/toolbox/components/web/ToolboxButtonWithPopup.tsx
index 9f89d665da..f8de565616 100644
--- a/react/features/base/toolbox/components/web/ToolboxButtonWithIconPopup.tsx
+++ b/react/features/base/toolbox/components/web/ToolboxButtonWithPopup.tsx
@@ -33,17 +33,17 @@ interface IProps {
/**
* Icon of the button.
*/
- icon: Function;
+ icon?: Function;
/**
* Flag used for disabling the small icon.
*/
- iconDisabled: boolean;
+ iconDisabled?: boolean;
/**
* The ID of the icon button.
*/
- iconId: string;
+ iconId?: string;
/**
* Popover close callback.
@@ -65,6 +65,11 @@ interface IProps {
*/
styles?: Object;
+ /**
+ * Whether the trigger for open/ close should be click or hover.
+ */
+ trigger?: 'hover' | 'click';
+
/**
* Whether or not the popover is visible.
*/
@@ -77,7 +82,7 @@ interface IProps {
* @param {Object} props - Component's props.
* @returns {ReactElement}
*/
-export default function ToolboxButtonWithIconPopup(props: IProps) {
+export default function ToolboxButtonWithPopup(props: IProps) {
const {
ariaControls,
ariaExpanded,
@@ -91,9 +96,29 @@ export default function ToolboxButtonWithIconPopup(props: IProps) {
onPopoverOpen,
popoverContent,
styles,
+ trigger,
visible
} = props;
+ if (!icon) {
+ return (
+ <div
+ className = 'settings-button-container'
+ style = { styles }>
+ <Popover
+ content = { popoverContent }
+ headingLabel = { ariaLabel }
+ onPopoverClose = { onPopoverClose }
+ onPopoverOpen = { onPopoverOpen }
+ position = 'top'
+ trigger = { trigger }
+ visible = { visible }>
+ {children}
+ </Popover>
+ </div>
+ );
+ }
+
const iconProps: any = {};
if (iconDisabled) {
diff --git a/react/features/gifs/actionTypes.ts b/react/features/gifs/actionTypes.ts
index 8940758638..4999d63a0e 100644
--- a/react/features/gifs/actionTypes.ts
+++ b/react/features/gifs/actionTypes.ts
@@ -27,15 +27,6 @@ export const HIDE_GIF_FOR_PARTICIPANT = 'HIDE_GIF_FOR_PARTICIPANT';
*/
export const REMOVE_GIF_FOR_PARTICIPANT = 'REMOVE_GIF_FOR_PARTICIPANT';
-/**
- * Set gif menu drawer visibility.
- * {{
- * type: SET_GIF_DRAWER_VISIBILITY,
- * visible: boolean
- * }}
- */
-export const SET_GIF_DRAWER_VISIBILITY = 'SET_GIF_DRAWER_VISIBILITY';
-
/**
* Set gif menu visibility.
* {{
diff --git a/react/features/gifs/actions.ts b/react/features/gifs/actions.ts
index 64a18e43ff..ab809b7d0b 100644
--- a/react/features/gifs/actions.ts
+++ b/react/features/gifs/actions.ts
@@ -2,7 +2,6 @@ import {
ADD_GIF_FOR_PARTICIPANT,
HIDE_GIF_FOR_PARTICIPANT,
REMOVE_GIF_FOR_PARTICIPANT,
- SET_GIF_DRAWER_VISIBILITY,
SET_GIF_MENU_VISIBILITY,
SHOW_GIF_FOR_PARTICIPANT
} from './actionTypes';
@@ -61,19 +60,6 @@ export function hideGif(participantId: string) {
};
}
-/**
- * Set visibility of the GIF drawer.
- *
- * @param {boolean} visible - Whether or not it should be visible.
- * @returns {Object}
- */
-export function setGifDrawerVisibility(visible: boolean) {
- return {
- type: SET_GIF_DRAWER_VISIBILITY,
- visible
- };
-}
-
/**
* Set visibility of the GIF menu.
*
diff --git a/react/features/gifs/components/web/GifsMenu.tsx b/react/features/gifs/components/web/GifsMenu.tsx
index 8c3580fb8c..5e8ed86647 100644
--- a/react/features/gifs/components/web/GifsMenu.tsx
+++ b/react/features/gifs/components/web/GifsMenu.tsx
@@ -12,11 +12,10 @@ import Input from '../../../base/ui/components/web/Input';
import { sendMessage } from '../../../chat/actions.any';
import { SCROLL_SIZE } from '../../../filmstrip/constants';
import { toggleReactionsMenuVisibility } from '../../../reactions/actions.web';
-import { setOverflowMenuVisible } from '../../../toolbox/actions.web';
+import { IReactionsMenuParent } from '../../../reactions/types';
import Drawer from '../../../toolbox/components/web/Drawer';
import JitsiPortal from '../../../toolbox/components/web/JitsiPortal';
-import { showOverflowDrawer } from '../../../toolbox/functions.web';
-import { setGifDrawerVisibility } from '../../actions';
+import { setGifMenuVisibility } from '../../actions';
import {
formatGifUrlMessage,
getGifAPIKey,
@@ -60,10 +59,17 @@ const useStyles = makeStyles()(theme => {
marginTop: theme.spacing(1)
},
- overflowMenu: {
+ overflowDrawerMenu: {
padding: theme.spacing(3),
width: '100%',
- boxSizing: 'border-box'
+ boxSizing: 'border-box',
+ height: '100%'
+ },
+
+ overflowMenu: {
+ height: '200px',
+ width: '201px',
+ marginBottom: '0px'
},
gifContainerOverflow: {
@@ -77,19 +83,25 @@ const useStyles = makeStyles()(theme => {
};
});
+interface IProps {
+ columns?: number;
+ parent: IReactionsMenuParent;
+}
+
/**
* Gifs menu.
*
* @returns {ReactElement}
*/
-function GifsMenu() {
+function GifsMenu({ columns = 2, parent }: IProps) {
const API_KEY = useSelector(getGifAPIKey);
const giphyFetch = new GiphyFetch(API_KEY);
const [ searchKey, setSearchKey ] = useState<string>();
const { classes: styles, cx } = useStyles();
const dispatch = useDispatch();
const { t } = useTranslation();
- const overflowDrawer: boolean = useSelector(showOverflowDrawer);
+ const isInOverflowMenu
+ = parent === IReactionsMenuParent.OverflowDrawer || parent === IReactionsMenuParent.OverflowMenu;
const { clientWidth } = useSelector((state: IReduxState) => state['features/base/responsive-ui']);
const rating = useSelector(getGifRating);
const proxyUrl = useSelector(getGiphyProxyUrl);
@@ -109,8 +121,7 @@ function GifsMenu() {
}, [ searchKey ]);
const onDrawerClose = useCallback(() => {
- dispatch(setGifDrawerVisibility(false));
- dispatch(setOverflowMenuVisible(false));
+ dispatch(setGifMenuVisibility(false));
}, []);
const handleGifClick = useCallback((gif, e) => {
@@ -121,9 +132,9 @@ function GifsMenu() {
batch(() => {
dispatch(sendMessage(formatGifUrlMessage(url), true));
dispatch(toggleReactionsMenuVisibility());
- overflowDrawer && onDrawerClose();
+ isInOverflowMenu && onDrawerClose();
});
- }, [ dispatch, overflowDrawer ]);
+ }, [ dispatch, isInOverflowMenu ]);
const handleGifKeyPress = useCallback((gif, e) => {
if (e.nativeEvent.keyCode === 13) {
@@ -191,7 +202,8 @@ function GifsMenu() {
const gifMenu = (
<div
className = { cx(styles.gifsMenu,
- overflowDrawer && styles.overflowMenu
+ parent === IReactionsMenuParent.OverflowDrawer && styles.overflowDrawerMenu,
+ parent === IReactionsMenuParent.OverflowMenu && styles.overflowMenu
) }>
<Input
autoFocus = { true }
@@ -208,9 +220,9 @@ function GifsMenu() {
value = { searchKey ?? '' } />
<div
className = { cx(styles.gifContainer,
- overflowDrawer && styles.gifContainerOverflow) }>
+ parent === IReactionsMenuParent.OverflowDrawer && styles.gifContainerOverflow) }>
<Grid
- columns = { 2 }
+ columns = { columns }
fetchGifs = { fetchGifs }
gutter = { 6 }
hideAttribution = { true }
@@ -219,9 +231,9 @@ function GifsMenu() {
noResultsMessage = { t('giphy.noResults') }
onGifClick = { handleGifClick }
onGifKeyPress = { handleGifKeyPress }
- width = { overflowDrawer
+ width = { parent === IReactionsMenuParent.OverflowDrawer
? clientWidth - (2 * OVERFLOW_DRAWER_PADDING) - SCROLL_SIZE
- : 320
+ : parent === IReactionsMenuParent.OverflowMenu ? 201 : 320
} />
</div>
<div className = { styles.logoContainer }>
@@ -233,7 +245,7 @@ function GifsMenu() {
</div>
);
- return overflowDrawer ? (
+ return parent === IReactionsMenuParent.OverflowDrawer ? (
<JitsiPortal>
<Drawer
className = { styles.drawer }
diff --git a/react/features/gifs/components/web/GifsMenuButton.tsx b/react/features/gifs/components/web/GifsMenuButton.tsx
index b20bb3dc9d..e35a2f73cc 100644
--- a/react/features/gifs/components/web/GifsMenuButton.tsx
+++ b/react/features/gifs/components/web/GifsMenuButton.tsx
@@ -3,30 +3,29 @@ import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import ReactionButton from '../../../reactions/components/web/ReactionButton';
-import { showOverflowDrawer } from '../../../toolbox/functions.web';
-import { setGifDrawerVisibility, setGifMenuVisibility } from '../../actions';
+import { IReactionsMenuParent } from '../../../reactions/types';
+import { setGifMenuVisibility } from '../../actions';
import { isGifsMenuOpen } from '../../functions.web';
-const GifsMenuButton = () => {
+interface IProps {
+ parent: IReactionsMenuParent;
+}
+
+const GifsMenuButton = ({ parent }: IProps) => {
const menuOpen = useSelector(isGifsMenuOpen);
- const overflowDrawer = useSelector(showOverflowDrawer);
const { t } = useTranslation();
const dispatch = useDispatch();
const icon = (
<img
alt = 'GIPHY Logo'
- height = { 24 }
+ height = { parent === IReactionsMenuParent.OverflowMenu ? 16 : 24 }
src = 'images/GIPHY_icon.png' />
);
- const handleClick = useCallback(() =>
- dispatch(
- overflowDrawer
- ? setGifDrawerVisibility(!menuOpen)
- : setGifMenuVisibility(!menuOpen)
- )
- , [ menuOpen, overflowDrawer ]);
+ const handleClick = useCallback(() => {
+ dispatch(setGifMenuVisibility(!menuOpen));
+ }, [ menuOpen, parent ]);
return (
<ReactionButton
diff --git a/react/features/gifs/functions.web.ts b/react/features/gifs/functions.web.ts
index 582677f4ba..342b956ec5 100644
--- a/react/features/gifs/functions.web.ts
+++ b/react/features/gifs/functions.web.ts
@@ -1,5 +1,4 @@
import { IReduxState } from '../app/types';
-import { showOverflowDrawer } from '../toolbox/functions.web';
export * from './function.any';
@@ -10,8 +9,5 @@ export * from './function.any';
* @returns {boolean}
*/
export function isGifsMenuOpen(state: IReduxState) {
- const overflowDrawer = showOverflowDrawer(state);
- const { drawerVisible, menuOpen } = state['features/gifs'];
-
- return overflowDrawer ? drawerVisible : menuOpen;
+ return state['features/gifs'].menuOpen;
}
diff --git a/react/features/gifs/reducer.ts b/react/features/gifs/reducer.ts
index 5e5d8b85ae..8131b3a2c8 100644
--- a/react/features/gifs/reducer.ts
+++ b/react/features/gifs/reducer.ts
@@ -4,12 +4,10 @@ import {
ADD_GIF_FOR_PARTICIPANT,
HIDE_GIF_FOR_PARTICIPANT,
REMOVE_GIF_FOR_PARTICIPANT,
- SET_GIF_DRAWER_VISIBILITY,
SET_GIF_MENU_VISIBILITY
} from './actionTypes';
const initialState = {
- drawerVisible: false,
gifList: new Map(),
menuOpen: false
};
@@ -20,7 +18,6 @@ export interface IGif {
}
export interface IGifsState {
- drawerVisible: boolean;
gifList: Map<string, IGif>;
menuOpen: boolean;
}
@@ -66,11 +63,6 @@ ReducerRegistry.register<IGifsState>(
gifList: newList
};
}
- case SET_GIF_DRAWER_VISIBILITY:
- return {
- ...state,
- drawerVisible: action.visible
- };
case SET_GIF_MENU_VISIBILITY:
return {
...state,
diff --git a/react/features/reactions/components/web/ReactionButton.tsx b/react/features/reactions/components/web/ReactionButton.tsx
index 9fffce43db..f4e4777d2e 100644
--- a/react/features/reactions/components/web/ReactionButton.tsx
+++ b/react/features/reactions/components/web/ReactionButton.tsx
@@ -101,9 +101,12 @@ class ReactionButton extends AbstractToolbarButton<IProps, IState> {
/**
* Handles reaction button click.
*
+ * @param {Event} event - The click event.
* @returns {void}
*/
- _onClickHandler() {
+ _onClickHandler(event: any) {
+ event.preventDefault();
+ event.stopPropagation();
this.props.onClick();
clearTimeout(this.state.increaseTimeout ?? 0);
const timeout = window.setTimeout(() => {
diff --git a/react/features/reactions/components/web/ReactionsMenu.tsx b/react/features/reactions/components/web/ReactionsMenu.tsx
index 5c8506c918..11f0830d3c 100644
--- a/react/features/reactions/components/web/ReactionsMenu.tsx
+++ b/react/features/reactions/components/web/ReactionsMenu.tsx
@@ -6,7 +6,6 @@ import { makeStyles } from 'tss-react/mui';
import { createReactionMenuEvent, createToolbarEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
import { IReduxState, IStore } from '../../../app/types';
-import { isMobileBrowser } from '../../../base/environment/utils';
import { raiseHand } from '../../../base/participants/actions';
import { getLocalParticipant, hasRaisedHand } from '../../../base/participants/functions';
import GifsMenu from '../../../gifs/components/web/GifsMenu';
@@ -15,7 +14,13 @@ import { isGifEnabled, isGifsMenuOpen } from '../../../gifs/functions';
import { dockToolbox } from '../../../toolbox/actions.web';
import { addReactionToBuffer } from '../../actions.any';
import { toggleReactionsMenuVisibility } from '../../actions.web';
-import { REACTIONS, REACTIONS_MENU_HEIGHT } from '../../constants';
+import {
+ GIFS_MENU_HEIGHT_IN_OVERFLOW_MENU,
+ RAISE_HAND_ROW_HEIGHT, REACTIONS,
+ REACTIONS_MENU_HEIGHT_DRAWER,
+ REACTIONS_MENU_HEIGHT_IN_OVERFLOW_MENU
+} from '../../constants';
+import { IReactionsMenuParent } from '../../types';
import ReactionButton from './ReactionButton';
@@ -36,11 +41,6 @@ interface IProps {
*/
_isGifMenuVisible: boolean;
- /**
- * Whether or not it's a mobile browser.
- */
- _isMobile: boolean;
-
/**
* The ID of the local participant.
*/
@@ -57,13 +57,59 @@ interface IProps {
dispatch: IStore['dispatch'];
/**
- * Whether or not it's displayed in the overflow menu.
+ * Indicates the parent of the reactions menu.
+ */
+ parent: IReactionsMenuParent;
+
+ /**
+ * Whether to show the raised hand button.
*/
- overflowMenu?: boolean;
+ showRaisedHand?: boolean;
}
-const useStyles = makeStyles()(theme => {
+const useStyles = makeStyles<IProps>()((theme, props: IProps) => {
+ const { parent, showRaisedHand, _isGifMenuVisible } = props;
+ let reactionsMenuHeight = REACTIONS_MENU_HEIGHT_DRAWER;
+
+ if (parent === IReactionsMenuParent.OverflowDrawer || parent === IReactionsMenuParent.OverflowMenu) {
+ if (parent === IReactionsMenuParent.OverflowMenu) {
+ reactionsMenuHeight = REACTIONS_MENU_HEIGHT_IN_OVERFLOW_MENU;
+
+ if (_isGifMenuVisible) {
+ reactionsMenuHeight += GIFS_MENU_HEIGHT_IN_OVERFLOW_MENU;
+ }
+ }
+ if (!showRaisedHand) {
+ reactionsMenuHeight -= RAISE_HAND_ROW_HEIGHT;
+ }
+ }
+
return {
+ reactionsMenuInOverflowMenu: {
+ '&.reactions-menu': {
+ '&.with-gif': {
+ width: 'inherit'
+ },
+ '.reactions-row': {
+ '.toolbox-icon': {
+ width: '24px',
+ height: '24px',
+
+ 'span.emoji': {
+ width: '24px',
+ height: '24px',
+ lineHeight: '24px',
+ fontSize: '16px'
+ }
+ }
+ },
+ '.raise-hand-row': {
+ '.toolbox-icon': {
+ height: '32px'
+ }
+ }
+ }
+ },
overflow: {
width: 'auto',
paddingBottom: 'max(env(safe-area-inset-bottom, 0), 16px)',
@@ -72,21 +118,55 @@ const useStyles = makeStyles()(theme => {
borderRadius: 0,
position: 'relative',
boxSizing: 'border-box',
- height: `${REACTIONS_MENU_HEIGHT}px`
+ height: `${reactionsMenuHeight}px`
}
};
});
-const ReactionsMenu = ({
- _dockToolbox,
- _isGifEnabled,
- _isGifMenuVisible,
- _isMobile,
- _raisedHand,
- dispatch,
- overflowMenu
-}: IProps) => {
- const { classes, cx } = useStyles();
+const _getReactionButtons = (dispatch: IStore['dispatch'], t: Function) => {
+ let modifierKey = 'Alt';
+
+ if (window.navigator?.platform) {
+ if (window.navigator.platform.indexOf('Mac') !== -1) {
+ modifierKey = '⌥';
+ }
+ }
+
+ return Object.keys(REACTIONS).map(key => {
+ /**
+ * Sends reaction message.
+ *
+ * @returns {void}
+ */
+ function doSendReaction() {
+ dispatch(addReactionToBuffer(key));
+ sendAnalytics(createReactionMenuEvent(key));
+ }
+
+ return (<ReactionButton
+ accessibilityLabel = { t(`toolbar.accessibilityLabel.${key}`) }
+ icon = { REACTIONS[key].emoji }
+ key = { key }
+ // eslint-disable-next-line react/jsx-no-bind
+ onClick = { doSendReaction }
+ toggled = { false }
+ tooltip = { `${t(`toolbar.${key}`)} (${modifierKey} + ${REACTIONS[key].shortcutChar})` } />);
+ });
+};
+
+const ReactionsMenu = (props: IProps) => {
+ const {
+ _dockToolbox,
+ _isGifEnabled,
+ _isGifMenuVisible,
+ _raisedHand,
+ dispatch,
+ parent,
+ showRaisedHand = false
+ } = props;
+ const isInOverflowMenu
+ = parent === IReactionsMenuParent.OverflowDrawer || parent === IReactionsMenuParent.OverflowMenu;
+ const { classes, cx } = useStyles(props);
const { t } = useTranslation();
useEffect(() => {
@@ -97,9 +177,9 @@ const ReactionsMenu = ({
};
}, []);
- const _doToggleRaiseHand = () => {
+ const _doToggleRaiseHand = useCallback(() => {
dispatch(raiseHand(!_raisedHand));
- };
+ }, [ _raisedHand ]);
const _onToolbarToggleRaiseHand = useCallback(() => {
sendAnalytics(createToolbarEvent(
@@ -109,47 +189,26 @@ const ReactionsMenu = ({
dispatch(toggleReactionsMenuVisibility());
}, [ _raisedHand ]);
- const _getReactionButtons = () => {
- let modifierKey = 'Alt';
-
- if (window.navigator?.platform) {
- if (window.navigator.platform.indexOf('Mac') !== -1) {
- modifierKey = '⌥';
- }
- }
+ const buttons = _getReactionButtons(dispatch, t);
- return Object.keys(REACTIONS).map(key => {
- /**
- * Sends reaction message.
- *
- * @returns {void}
- */
- function doSendReaction() {
- dispatch(addReactionToBuffer(key));
- sendAnalytics(createReactionMenuEvent(key));
- }
-
- return (<ReactionButton
- accessibilityLabel = { t(`toolbar.accessibilityLabel.${key}`) }
- icon = { REACTIONS[key].emoji }
- key = { key }
- // eslint-disable-next-line react/jsx-no-bind
- onClick = { doSendReaction }
- toggled = { false }
- tooltip = { `${t(`toolbar.${key}`)} (${modifierKey} + ${REACTIONS[key].shortcutChar})` } />);
- });
- };
+ if (_isGifEnabled) {
+ buttons.push(<GifsMenuButton parent = { parent } />);
+ }
return (
<div
- className = { cx('reactions-menu', _isGifEnabled && 'with-gif',
- overflowMenu && `overflow ${classes.overflow}`) }>
- {_isGifEnabled && _isGifMenuVisible && <GifsMenu />}
+ className = { cx('reactions-menu',
+ parent === IReactionsMenuParent.OverflowMenu && classes.reactionsMenuInOverflowMenu,
+ _isGifEnabled && 'with-gif',
+ isInOverflowMenu && `overflow ${classes.overflow}`) }>
+ {_isGifEnabled && _isGifMenuVisible
+ && <GifsMenu
+ columns = { parent === IReactionsMenuParent.OverflowMenu ? 1 : undefined }
+ parent = { parent } />}
<div className = 'reactions-row'>
- {_getReactionButtons()}
- {_isGifEnabled && <GifsMenuButton />}
+ { buttons }
</div>
- {_isMobile && (
+ {showRaisedHand && (
<div className = 'raise-hand-row'>
<ReactionButton
accessibilityLabel = { t('toolbar.accessibilityLabel.raiseHand') }
@@ -157,7 +216,7 @@ const ReactionsMenu = ({
key = 'raisehand'
label = {
`${t(`toolbar.${_raisedHand ? 'lowerYourHand' : 'raiseYourHand'}`)}
- ${overflowMenu ? '' : ' (R)'}`
+ ${isInOverflowMenu ? '' : ' (R)'}`
}
onClick = { _onToolbarToggleRaiseHand }
toggled = { true } />
@@ -175,11 +234,9 @@ const ReactionsMenu = ({
*/
function mapStateToProps(state: IReduxState) {
const localParticipant = getLocalParticipant(state);
- const { isNarrowLayout } = state['features/base/responsive-ui'];
return {
_localParticipantID: localParticipant?.id,
- _isMobile: isMobileBrowser() || isNarrowLayout,
_isGifEnabled: isGifEnabled(state),
_isGifMenuVisible: isGifsMenuOpen(state),
_raisedHand: hasRaisedHand(localParticipant)
diff --git a/react/features/reactions/components/web/ReactionsMenuButton.tsx b/react/features/reactions/components/web/ReactionsMenuButton.tsx
index dab8e76f2d..a0cfe67a95 100644
--- a/react/features/reactions/components/web/ReactionsMenuButton.tsx
+++ b/react/features/reactions/components/web/ReactionsMenuButton.tsx
@@ -1,16 +1,18 @@
-import React, { useCallback } from 'react';
+import React, { ReactElement, useCallback } from 'react';
import { WithTranslation } from 'react-i18next';
import { connect, useSelector } from 'react-redux';
import { IReduxState } from '../../../app/types';
import { isMobileBrowser } from '../../../base/environment/utils';
import { translate } from '../../../base/i18n/functions';
-import { IconArrowUp } from '../../../base/icons/svg';
-import ToolboxButtonWithIconPopup from '../../../base/toolbox/components/web/ToolboxButtonWithIconPopup';
+import { IconArrowUp, IconFaceSmile } from '../../../base/icons/svg';
+import AbstractButton, { type IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton';
+import ToolboxButtonWithPopup from '../../../base/toolbox/components/web/ToolboxButtonWithPopup';
import { toggleReactionsMenuVisibility } from '../../actions.web';
import { IReactionEmojiProps } from '../../constants';
import { getReactionsQueue, isReactionsEnabled } from '../../functions.any';
-import { getReactionsMenuVisibility } from '../../functions.web';
+import { getReactionsMenuVisibility, isReactionsButtonEnabled } from '../../functions.web';
+import { IReactionsMenuParent } from '../../types';
import RaiseHandButton from './RaiseHandButton';
import ReactionEmoji from './ReactionEmoji';
@@ -19,9 +21,14 @@ import ReactionsMenu from './ReactionsMenu';
interface IProps extends WithTranslation {
/**
- * Whether or not reactions are enabled.
+ * Whether a mobile browser is used or not.
*/
- _reactionsEnabled: Boolean;
+ _isMobile: boolean;
+
+ /**
+ * Whether the reactions should be displayed on separate button or not.
+ */
+ _reactionsButtonEnabled: boolean;
/**
* The button's key.
@@ -60,13 +67,28 @@ interface IProps extends WithTranslation {
reactionsQueue: Array<IReactionEmojiProps>;
}
+
+/**
+ * Implementation of a button for reactions.
+ */
+class ReactionsButtonImpl extends AbstractButton<AbstractButtonProps> {
+ accessibilityLabel = 'toolbar.accessibilityLabel.reactions';
+ icon = IconFaceSmile;
+ label = 'toolbar.reactions';
+ toggledLabel = 'toolbar.reactions';
+ tooltip = 'toolbar.reactions';
+}
+
+const ReactionsButton = translate(connect()(ReactionsButtonImpl));
+
/**
* Button used for the reactions menu.
*
* @returns {ReactElement}
*/
function ReactionsMenuButton({
- _reactionsEnabled,
+ _reactionsButtonEnabled,
+ _isMobile,
buttonKey,
dispatch,
handleClick,
@@ -85,43 +107,69 @@ function ReactionsMenuButton({
!visible && toggleReactionsMenu();
}, [ visible, toggleReactionsMenu ]);
+ const closeReactionsMenu = useCallback(() => {
+ visible && toggleReactionsMenu();
+ }, [ visible, toggleReactionsMenu ]);
+
const reactionsMenu = (<div className = 'reactions-menu-container'>
- <ReactionsMenu />
+ <ReactionsMenu parent = { IReactionsMenuParent.Button } />
</div>);
- return (
- <div className = 'reactions-menu-popup-container'>
- {!_reactionsEnabled || isNarrow ? (
+ let content: ReactElement | null = null;
+
+ if (_reactionsButtonEnabled) {
+ content = (
+ <ToolboxButtonWithPopup
+ ariaControls = 'reactions-menu-dialog'
+ ariaExpanded = { isOpen }
+ ariaHasPopup = { true }
+ ariaLabel = { t('toolbar.accessibilityLabel.reactionsMenu') }
+ onPopoverClose = { _isMobile ? closeReactionsMenu : toggleReactionsMenu }
+ onPopoverOpen = { openReactionsMenu }
+ popoverContent = { reactionsMenu }
+ trigger = { _isMobile ? 'click' : undefined }
+ visible = { visible }>
+ <ReactionsButton
+ buttonKey = { buttonKey }
+ notifyMode = { notifyMode } />
+ </ToolboxButtonWithPopup>);
+ } else {
+ content = isNarrow
+ ? (
<RaiseHandButton
buttonKey = { buttonKey }
handleClick = { handleClick }
notifyMode = { notifyMode } />)
- : (
- <ToolboxButtonWithIconPopup
- ariaControls = 'reactions-menu-dialog'
- ariaExpanded = { isOpen }
- ariaHasPopup = { true }
- ariaLabel = { t('toolbar.accessibilityLabel.reactionsMenu') }
- icon = { IconArrowUp }
- iconDisabled = { false }
- iconId = 'reactions-menu-button'
- onPopoverClose = { toggleReactionsMenu }
- onPopoverOpen = { openReactionsMenu }
- popoverContent = { reactionsMenu }
- visible = { visible }>
- <RaiseHandButton
- buttonKey = { buttonKey }
- handleClick = { handleClick }
- notifyMode = { notifyMode } />
- </ToolboxButtonWithIconPopup>
- )}
+ : (
+ <ToolboxButtonWithPopup
+ ariaControls = 'reactions-menu-dialog'
+ ariaExpanded = { isOpen }
+ ariaHasPopup = { true }
+ ariaLabel = { t('toolbar.accessibilityLabel.reactionsMenu') }
+ icon = { IconArrowUp }
+ iconDisabled = { false }
+ iconId = 'reactions-menu-button'
+ onPopoverClose = { toggleReactionsMenu }
+ onPopoverOpen = { openReactionsMenu }
+ popoverContent = { reactionsMenu }
+ visible = { visible }>
+ <RaiseHandButton
+ buttonKey = { buttonKey }
+ handleClick = { handleClick }
+ notifyMode = { notifyMode } />
+ </ToolboxButtonWithPopup>);
+ }
+
+ return (
+ <div className = 'reactions-menu-popup-container'>
+ { content }
{reactionsQueue.map(({ reaction, uid }, index) => (<ReactionEmoji
index = { index }
key = { uid }
reaction = { reaction }
uid = { uid } />))}
- </div>
- );
+ </div>);
+
}
/**
@@ -134,9 +182,11 @@ function mapStateToProps(state: IReduxState) {
const { isNarrowLayout } = state['features/base/responsive-ui'];
return {
+ _reactionsButtonEnabled: isReactionsButtonEnabled(state),
_reactionsEnabled: isReactionsEnabled(state),
+ _isMobile: isMobileBrowser(),
isOpen: getReactionsMenuVisibility(state),
- isNarrow: isMobileBrowser() || isNarrowLayout,
+ isNarrow: isNarrowLayout,
reactionsQueue: getReactionsQueue(state)
};
}
diff --git a/react/features/reactions/constants.ts b/react/features/reactions/constants.ts
index 23e70cb494..ca1d28c729 100644
--- a/react/features/reactions/constants.ts
+++ b/react/features/reactions/constants.ts
@@ -8,9 +8,24 @@ import {
} from './sounds';
/**
- * Reactions menu height on mobile web (px).
+ * The height of the raise hand row in the reactions menu.
*/
-export const REACTIONS_MENU_HEIGHT = 144;
+export const RAISE_HAND_ROW_HEIGHT = 54;
+
+/**
+ * The height of the gifs menu when displayed as part of the overflow menu.
+ */
+export const GIFS_MENU_HEIGHT_IN_OVERFLOW_MENU = 200;
+
+/**
+ * Reactions menu height when displayed as part of drawer.
+ */
+export const REACTIONS_MENU_HEIGHT_DRAWER = 144;
+
+/**
+ * Reactions menu height when displayed as part of overflow menu.
+ */
+export const REACTIONS_MENU_HEIGHT_IN_OVERFLOW_MENU = 106;
/**
* The payload name for the datachannel/endpoint reaction event.
diff --git a/react/features/reactions/functions.web.ts b/react/features/reactions/functions.web.ts
index 21151ade86..2b18927c73 100644
--- a/react/features/reactions/functions.web.ts
+++ b/react/features/reactions/functions.web.ts
@@ -1,4 +1,7 @@
import { IReduxState } from '../app/types';
+import { getToolbarButtons } from '../base/config/functions.web';
+
+import { isReactionsEnabled } from './functions.any';
export * from './functions.any';
@@ -11,3 +14,13 @@ export * from './functions.any';
export function getReactionsMenuVisibility(state: IReduxState): boolean {
return state['features/reactions'].visible;
}
+
+/**
+ * Whether or not the reactions button is enabled.
+ *
+ * @param {Object} state - The Redux state object.
+ * @returns {boolean}
+ */
+export function isReactionsButtonEnabled(state: IReduxState) {
+ return Boolean(getToolbarButtons(state).includes('reactions')) && isReactionsEnabled(state);
+}
diff --git a/react/features/reactions/types.ts b/react/features/reactions/types.ts
new file mode 100644
index 0000000000..bcc1a5c907
--- /dev/null
+++ b/react/features/reactions/types.ts
@@ -0,0 +1,5 @@
+export enum IReactionsMenuParent {
+ Button = 1,
+ OverflowMenu = 2,
+ OverflowDrawer = 3
+}
diff --git a/react/features/toolbox/components/web/OverflowMenuButton.tsx b/react/features/toolbox/components/web/OverflowMenuButton.tsx
index 3faa0bccc4..415ae195e9 100644
--- a/react/features/toolbox/components/web/OverflowMenuButton.tsx
+++ b/react/features/toolbox/components/web/OverflowMenuButton.tsx
@@ -1,14 +1,25 @@
-import React, { ReactNode, useCallback } from 'react';
-import { useSelector } from 'react-redux';
+import React, { useCallback } from 'react';
+import { useTranslation } from 'react-i18next';
+import { useDispatch, useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
import Popover from '../../../base/popover/components/Popover.web';
+import ContextMenu from '../../../base/ui/components/web/ContextMenu';
+import ContextMenuItemGroup from '../../../base/ui/components/web/ContextMenuItemGroup';
+import { setGifMenuVisibility } from '../../../gifs/actions';
+import { isGifsMenuOpen } from '../../../gifs/functions.web';
import ReactionEmoji from '../../../reactions/components/web/ReactionEmoji';
import ReactionsMenu from '../../../reactions/components/web/ReactionsMenu';
-import { REACTIONS_MENU_HEIGHT } from '../../../reactions/constants';
+import {
+ GIFS_MENU_HEIGHT_IN_OVERFLOW_MENU,
+ RAISE_HAND_ROW_HEIGHT,
+ REACTIONS_MENU_HEIGHT_DRAWER,
+ REACTIONS_MENU_HEIGHT_IN_OVERFLOW_MENU
+} from '../../../reactions/constants';
import { getReactionsQueue } from '../../../reactions/functions.any';
+import { IReactionsMenuParent } from '../../../reactions/types';
import { DRAWER_MAX_HEIGHT } from '../../constants';
import { showOverflowDrawer } from '../../functions.web';
@@ -27,48 +38,85 @@ interface IProps {
ariaControls: string;
/**
- * A child React Element to display within {@code Popover}.
+ * Information about the buttons that need to be rendered in the overflow menu.
*/
- children: ReactNode;
+ buttons: Object[];
/**
* Whether or not the OverflowMenu popover should display.
*/
isOpen: boolean;
+ /**
+ * Esc key handler.
+ */
+ onToolboxEscKey: (e?: React.KeyboardEvent) => void;
+
/**
* Callback to change the visibility of the overflow menu.
*/
onVisibilityChange: Function;
/**
- * Whether or not to display the reactions in the mobile menu.
+ * Whether to show the raise hand in the reactions menu or not.
+ */
+ showRaiseHandInReactionsMenu: boolean;
+
+ /**
+ * Whether or not to display the reactions menu.
*/
- showMobileReactions: boolean;
+ showReactionsMenu: boolean;
}
-const useStyles = makeStyles()(() => {
+const useStyles = makeStyles<{ overflowDrawer: boolean; reactionsMenuHeight: number; }>()(
+(_theme, { reactionsMenuHeight, overflowDrawer }) => {
return {
overflowMenuDrawer: {
- overflowY: 'auto' as const,
- height: `calc(${DRAWER_MAX_HEIGHT} - ${REACTIONS_MENU_HEIGHT}px - 16px)`
+ overflow: 'hidden',
+ height: `calc(${DRAWER_MAX_HEIGHT} - ${reactionsMenuHeight}px - 16px)`
+ },
+ contextMenu: {
+ position: 'relative' as const,
+ right: 'auto',
+ margin: 0,
+ marginBottom: '8px',
+ maxHeight: overflowDrawer ? undefined : 'calc(100vh - 100px)',
+ paddingBottom: overflowDrawer ? undefined : 0,
+ minWidth: '240px',
+ overflow: 'hidden'
+ },
+ content: {
+ position: 'relative',
+ maxHeight: overflowDrawer
+ ? `calc(100% - ${reactionsMenuHeight}px - 16px)` : `calc(100vh - 100px - ${reactionsMenuHeight}px)`,
+ overflowY: 'auto'
+ },
+ footer: {
+ position: 'relative',
+ bottom: 0
}
};
});
const OverflowMenuButton = ({
- children,
+ buttons,
isOpen,
+ onToolboxEscKey,
onVisibilityChange,
- showMobileReactions
+ showRaiseHandInReactionsMenu,
+ showReactionsMenu
}: IProps) => {
- const { classes } = useStyles();
const overflowDrawer = useSelector(showOverflowDrawer);
const reactionsQueue = useSelector(getReactionsQueue);
+ const isGiphyVisible = useSelector(isGifsMenuOpen);
+ const dispatch = useDispatch();
const onCloseDialog = useCallback(() => {
onVisibilityChange(false);
- }, [ onVisibilityChange ]);
+ if (isGiphyVisible && !overflowDrawer) {
+ dispatch(setGifMenuVisibility(false));
+ }
+ }, [ onVisibilityChange, setGifMenuVisibility, isGiphyVisible, overflowDrawer, dispatch ]);
const onOpenDialog = useCallback(() => {
onVisibilityChange(true);
@@ -88,50 +136,118 @@ const OverflowMenuButton = ({
onVisibilityChange(!isOpen);
}, [ isOpen, onVisibilityChange ]);
- return (
- <div className = 'toolbox-button-wth-dialog context-menu'>
+ const toolbarAccLabel = 'toolbar.accessibilityLabel.moreActionsMenu';
+ const { t } = useTranslation();
+ let reactionsMenuHeight = 0;
+
+ if (showReactionsMenu) {
+ reactionsMenuHeight = REACTIONS_MENU_HEIGHT_DRAWER;
+ if (!overflowDrawer) {
+ reactionsMenuHeight = REACTIONS_MENU_HEIGHT_IN_OVERFLOW_MENU;
+ }
+ if (!showRaiseHandInReactionsMenu) {
+ reactionsMenuHeight -= RAISE_HAND_ROW_HEIGHT;
+ }
+ if (!overflowDrawer && isGiphyVisible) {
+ reactionsMenuHeight += GIFS_MENU_HEIGHT_IN_OVERFLOW_MENU;
+ }
+ }
+ const { classes } = useStyles({
+ reactionsMenuHeight,
+ overflowDrawer
+ });
+
+ const groupsJSX = buttons.map((buttonGroup: any) => (
+ <ContextMenuItemGroup key = { `group-${buttonGroup[0].group}` }>
+ {buttonGroup.map(({ key, Content, ...rest }: { Content: React.ElementType; key: string; }) => {
+ const props: { buttonKey?: string; contextMenu?: boolean; showLabel?: boolean; } = { ...rest };
+
+ if (key !== 'reactions') {
+ props.buttonKey = key;
+ props.contextMenu = true;
+ props.showLabel = true;
+ }
+
+ return (
+ <Content
+ { ...props }
+ key = { key } />);
+ })}
+ </ContextMenuItemGroup>));
+
+ const overflowMenu = groupsJSX && (
+ <ContextMenu
+ accessibilityLabel = { t(toolbarAccLabel) }
+ className = { classes.contextMenu }
+ hidden = { false }
+ id = 'overflow-context-menu'
+ inDrawer = { overflowDrawer }
+ onKeyDown = { onToolboxEscKey }>
+ <div className = { classes.content }>
+ { groupsJSX }
+ </div>
{
- overflowDrawer ? (
- <>
- <OverflowToggleButton
- handleClick = { toggleDialogVisibility }
- isOpen = { isOpen }
- onKeyDown = { onEscClick } />
- <JitsiPortal>
- <Drawer
- isOpen = { isOpen }
- onClose = { onCloseDialog }>
- <>
- <div className = { classes.overflowMenuDrawer }>
- {children}
- </div>
- {showMobileReactions && <ReactionsMenu overflowMenu = { true } />}
- </>
- </Drawer>
- {showMobileReactions && <div className = 'reactions-animations-container'>
- {reactionsQueue.map(({ reaction, uid }, index) => (<ReactionEmoji
- index = { index }
- key = { uid }
- reaction = { reaction }
- uid = { uid } />))}
- </div>}
- </JitsiPortal>
- </>
- ) : (
- <Popover
- content = { children }
- headingId = 'overflow-context-menu'
- onPopoverClose = { onCloseDialog }
- onPopoverOpen = { onOpenDialog }
- position = 'top'
- trigger = 'click'
- visible = { isOpen }>
- <OverflowToggleButton
- isOpen = { isOpen }
- onKeyDown = { onEscClick } />
- </Popover>
- )
+ showReactionsMenu && (<div className = { classes.footer }>
+ <ReactionsMenu
+ parent = {
+ overflowDrawer ? IReactionsMenuParent.OverflowDrawer : IReactionsMenuParent.OverflowMenu }
+ showRaisedHand = { showRaiseHandInReactionsMenu } />
+ </div>)
}
+ </ContextMenu>);
+
+ if (overflowDrawer) {
+ return (
+ <div className = 'toolbox-button-wth-dialog context-menu'>
+ <>
+ <OverflowToggleButton
+ handleClick = { toggleDialogVisibility }
+ isOpen = { isOpen }
+ onKeyDown = { onEscClick } />
+ <JitsiPortal>
+ <Drawer
+ isOpen = { isOpen }
+ onClose = { onCloseDialog }>
+ <>
+ <div className = { classes.overflowMenuDrawer }>
+ { overflowMenu }
+ </div>
+ </>
+ </Drawer>
+ {showReactionsMenu && <div className = 'reactions-animations-container'>
+ {reactionsQueue.map(({ reaction, uid }, index) => (<ReactionEmoji
+ index = { index }
+ key = { uid }
+ reaction = { reaction }
+ uid = { uid } />))}
+ </div>}
+ </JitsiPortal>
+ </>
+ </div>
+ );
+ }
+
+ return (
+ <div className = 'toolbox-button-wth-dialog context-menu'>
+ <Popover
+ content = { overflowMenu }
+ headingId = 'overflow-context-menu'
+ onPopoverClose = { onCloseDialog }
+ onPopoverOpen = { onOpenDialog }
+ position = 'top'
+ trigger = 'click'
+ visible = { isOpen }>
+ <OverflowToggleButton
+ isOpen = { isOpen }
+ onKeyDown = { onEscClick } />
+ </Popover>
+ {showReactionsMenu && <div className = 'reactions-animations-container'>
+ {reactionsQueue.map(({ reaction, uid }, index) => (<ReactionEmoji
+ index = { index }
+ key = { uid }
+ reaction = { reaction }
+ uid = { uid } />))}
+ </div>}
</div>
);
};
diff --git a/react/features/toolbox/components/web/Toolbox.tsx b/react/features/toolbox/components/web/Toolbox.tsx
index d4f78f811f..988b4a6ed9 100644
--- a/react/features/toolbox/components/web/Toolbox.tsx
+++ b/react/features/toolbox/components/web/Toolbox.tsx
@@ -30,7 +30,6 @@ import {
import { getLocalVideoTrack } from '../../../base/tracks/functions.web';
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';
import ChatButton from '../../../chat/components/web/ChatButton';
import EmbedMeetingButton from '../../../embed-meeting/components/EmbedMeetingButton';
@@ -54,9 +53,10 @@ 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 { isReactionsEnabled } from '../../../reactions/functions.web';
+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';
@@ -273,6 +273,11 @@ interface IProps extends WithTranslation {
*/
_raisedHand: boolean;
+ /**
+ * Whether or not to display reactions in separate button.
+ */
+ _reactionsButtonEnabled: boolean;
+
/**
* Whether or not reactions feature is enabled.
*/
@@ -717,6 +722,7 @@ class Toolbox extends Component<IProps> {
_isNarrowLayout,
_isSpeakerStatsDisabled,
_multiStreamModeEnabled,
+ _reactionsButtonEnabled,
_reactionsEnabled,
_screenSharing,
_shortcutsEnabled,
@@ -755,8 +761,21 @@ class Toolbox extends Component<IProps> {
group: 2
};
- const raisehand = (!_reactionsEnabled || (!_isNarrowLayout && !_isMobile)) && {
+ // 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
@@ -931,6 +950,7 @@ class Toolbox extends Component<IProps> {
desktop,
chat,
raisehand,
+ reactions,
participants,
invite,
tileview,
@@ -1416,6 +1436,7 @@ class Toolbox extends Component<IProps> {
_overflowDrawer,
_overflowMenuVisible,
_reactionsEnabled,
+ _reactionsButtonEnabled,
_toolbarButtons,
classes,
t
@@ -1425,6 +1446,12 @@ class Toolbox extends Component<IProps> {
const containerClassName = `toolbox-content${_isMobile || _isNarrowLayout ? ' toolbox-content-mobile' : ''}`;
const { mainMenuButtons, overflowMenuButtons } = this._getVisibleButtons();
+ const raiseHandInOverflowMenu = overflowMenuButtons.some(({ key }) => key === 'raisehand');
+ const showReactionsInOverflowMenu
+ = (_reactionsEnabled && !_reactionsButtonEnabled
+ && (raiseHandInOverflowMenu || _isNarrowLayout || _isMobile))
+ || overflowMenuButtons.some(({ key }) => key === 'reactions');
+ const showRaiseHandInReactionsMenu = showReactionsInOverflowMenu && raiseHandInOverflowMenu;
return (
<div className = { containerClassName }>
@@ -1448,47 +1475,36 @@ class Toolbox extends Component<IProps> {
{Boolean(overflowMenuButtons.length) && (
<OverflowMenuButton
ariaControls = 'overflow-menu'
- isOpen = { _overflowMenuVisible }
- key = 'overflow-menu'
- onVisibilityChange = { this._onSetOverflowVisible }
- showMobileReactions = {
- _reactionsEnabled && (_isMobile || _isNarrowLayout)
- }>
- <ContextMenu
- accessibilityLabel = { t(toolbarAccLabel) }
- className = { classes.contextMenu }
- hidden = { false }
- id = 'overflow-context-menu'
- inDrawer = { _overflowDrawer }
- onKeyDown = { this._onEscKey }>
- {overflowMenuButtons.reduce((acc, val) => {
- if (acc.length) {
- const prev = acc[acc.length - 1];
- const group = prev[prev.length - 1].group;
-
- if (group === val.group) {
- prev.push(val);
- } else {
- acc.push([ val ]);
- }
+ buttons = { overflowMenuButtons.reduce((acc, val) => {
+ if (val.key === 'reactions' && showReactionsInOverflowMenu) {
+ return acc;
+ }
+
+ if (val.key === 'raisehand' && showRaiseHandInReactionsMenu) {
+ return acc;
+ }
+
+ if (acc.length) {
+ const prev = acc[acc.length - 1];
+ const group = prev[prev.length - 1].group;
+
+ if (group === val.group) {
+ prev.push(val);
} else {
acc.push([ val ]);
}
+ } else {
+ acc.push([ val ]);
+ }
- return acc;
- }, []).map((buttonGroup: any) => (
- <ContextMenuItemGroup key = { `group-${buttonGroup[0].group}` }>
- {buttonGroup.map(({ key, Content, ...rest }: any) => (
- key !== 'raisehand' || !_reactionsEnabled)
- && <Content
- { ...rest }
- buttonKey = { key }
- contextMenu = { true }
- key = { key }
- showLabel = { true } />)}
- </ContextMenuItemGroup>))}
- </ContextMenu>
- </OverflowMenuButton>
+ return acc;
+ }, []) }
+ isOpen = { _overflowMenuVisible }
+ key = 'overflow-menu'
+ onToolboxEscKey = { this._onEscKey }
+ onVisibilityChange = { this._onSetOverflowVisible }
+ showRaiseHandInReactionsMenu = { showRaiseHandInReactionsMenu }
+ showReactionsMenu = { showReactionsInOverflowMenu } />
)}
{ isToolbarButtonEnabled('hangup', _toolbarButtons) && (
@@ -1558,6 +1574,7 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
const localVideo = getLocalVideoTrack(state['features/base/tracks']);
const { clientWidth } = state['features/base/responsive-ui'];
let toolbarButtons = ownProps.toolbarButtons || getToolbarButtons(state);
+ const _reactionsEnabled = isReactionsEnabled(state);
if (iAmVisitor(state)) {
toolbarButtons = VISITORS_MODE_BUTTONS.filter(e => toolbarButtons.indexOf(e) > -1);
@@ -1594,7 +1611,8 @@ function _mapStateToProps(state: IReduxState, ownProps: any) {
_overflowDrawer: overflowDrawer,
_participantsPaneOpen: getParticipantsPaneOpen(state),
_raisedHand: hasRaisedHand(localParticipant),
- _reactionsEnabled: isReactionsEnabled(state),
+ _reactionsButtonEnabled: isReactionsButtonEnabled(state),
+ _reactionsEnabled,
_screenSharing: isScreenVideoShared(state),
_shortcutsEnabled: areKeyboardShortcutsEnabled(state),
_tileViewEnabled: shouldDisplayTileView(state),
diff --git a/react/features/toolbox/constants.ts b/react/features/toolbox/constants.ts
index 4723942858..f242fe1ef5 100644
--- a/react/features/toolbox/constants.ts
+++ b/react/features/toolbox/constants.ts
@@ -2,6 +2,10 @@
* Thresholds for displaying toolbox buttons.
*/
export const THRESHOLDS = [
+ {
+ width: 565,
+ order: [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'reactions', 'participants', 'tileview' ]
+ },
{
width: 520,
order: [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'participants', 'tileview' ]
diff --git a/react/features/toolbox/functions.web.ts b/react/features/toolbox/functions.web.ts
index 6054fa3c95..799ecdc043 100644
--- a/react/features/toolbox/functions.web.ts
+++ b/react/features/toolbox/functions.web.ts
@@ -124,6 +124,16 @@ export function showOverflowDrawer(state: IReduxState) {
return state['features/toolbox'].overflowDrawer;
}
+/**
+ * Returns true if the overflow menu button is displayed and false otherwise.
+ *
+ * @param {IReduxState} state - The state from the Redux store.
+ * @returns {boolean} - True if the overflow menu button is displayed and false otherwise.
+ */
+export function showOverflowMenu(state: IReduxState) {
+ return state['features/toolbox'].overflowMenuVisible;
+}
+
/**
* Indicates whether the toolbox is enabled or not.
*