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(visitors): Updates buttons visible to visitors.

Дамян Минковf060ab9d2647
diff --git a/react/features/base/participants/functions.ts b/react/features/base/participants/functions.ts
index a7807010a3..82cb69d7f2 100644
--- a/react/features/base/participants/functions.ts
+++ b/react/features/base/participants/functions.ts
@@ -5,6 +5,7 @@ import { IReduxState, IStore } from '../../app/types';
import { isStageFilmstripAvailable } from '../../filmstrip/functions';
import { isAddPeopleEnabled, isDialOutEnabled } from '../../invite/functions';
import { toggleShareDialog } from '../../share-room/actions';
+import { iAmVisitor } from '../../visitors/functions';
import { IStateful } from '../app/types';
import { GRAVATAR_BASE_URL } from '../avatar/constants';
import { isCORSAvatarURL } from '../avatar/functions';
@@ -256,8 +257,10 @@ export function getParticipantCount(stateful: IStateful) {
fakeParticipants,
sortedRemoteVirtualScreenshareParticipants
} = state['features/base/participants'];
+ const _iAmVisitor = iAmVisitor(stateful);
- return remote.size - fakeParticipants.size - sortedRemoteVirtualScreenshareParticipants.size + (local ? 1 : 0);
+ return remote.size - fakeParticipants.size - sortedRemoteVirtualScreenshareParticipants.size
+ + (local && !_iAmVisitor ? 1 : 0);
}
/**
@@ -409,8 +412,9 @@ export function getMutedStateByParticipantAndMediaType(
export function getParticipantCountWithFake(stateful: IStateful) {
const state = toState(stateful);
const { local, localScreenShare, remote } = state['features/base/participants'];
+ const _iAmVisitor = iAmVisitor(stateful);
- return remote.size + (local ? 1 : 0) + (localScreenShare ? 1 : 0);
+ return remote.size + (local && !_iAmVisitor ? 1 : 0) + (localScreenShare ? 1 : 0);
}
/**
diff --git a/react/features/participants-pane/components/native/MeetingParticipantList.tsx b/react/features/participants-pane/components/native/MeetingParticipantList.tsx
index c539dae880..5e0037590b 100644
--- a/react/features/participants-pane/components/native/MeetingParticipantList.tsx
+++ b/react/features/participants-pane/components/native/MeetingParticipantList.tsx
@@ -22,6 +22,7 @@ import {
} from '../../../breakout-rooms/functions';
import { doInvitePeople } from '../../../invite/actions.native';
import { getInviteOthersControl } from '../../../share-room/functions';
+import { iAmVisitor } from '../../../visitors/functions';
import { participantMatchesSearch, shouldRenderInviteButton } from '../../functions';
import MeetingParticipantItem from './MeetingParticipantItem';
@@ -37,6 +38,7 @@ const MeetingParticipantList = () => {
const keyExtractor
= useCallback((e: undefined, i: number) => i.toString(), []);
const localParticipant = useSelector(getLocalParticipant);
+ const _iAmVisitor = useSelector(iAmVisitor);
const onInvite = useCallback(() => {
setShareDialogVisiblity(isAddPeopleFeatureEnabled, dispatch);
dispatch(doInvitePeople());
@@ -103,7 +105,10 @@ const MeetingParticipantList = () => {
placeholder = { t('participantsPane.search') }
value = { searchString } />
<FlatList
- data = { [ localParticipant?.id, ...sortedRemoteParticipants ] as Array<any> }
+ data = { _iAmVisitor
+ ? [ ...sortedRemoteParticipants ]
+ : [ localParticipant?.id, ...sortedRemoteParticipants ] as Array<any>
+ }
keyExtractor = { keyExtractor }
/* eslint-disable react/jsx-no-bind */
diff --git a/react/features/participants-pane/components/web/MeetingParticipants.tsx b/react/features/participants-pane/components/web/MeetingParticipants.tsx
index 507a622a0c..b773d1e31f 100644
--- a/react/features/participants-pane/components/web/MeetingParticipants.tsx
+++ b/react/features/participants-pane/components/web/MeetingParticipants.tsx
@@ -15,6 +15,7 @@ import { normalizeAccents } from '../../../base/util/strings.web';
import { getBreakoutRooms, getCurrentRoomId, isInBreakoutRoom } from '../../../breakout-rooms/functions';
import { isButtonEnabled, showOverflowDrawer } from '../../../toolbox/functions.web';
import { muteRemote } from '../../../video-menu/actions.web';
+import { iAmVisitor } from '../../../visitors/functions';
import { getSortedParticipantIds, isCurrentRoomRenamable, shouldRenderInviteButton } from '../../functions';
import { useParticipantDrawer } from '../../hooks';
import RenameButton from '../breakout-rooms/components/web/RenameButton';
@@ -174,12 +175,18 @@ function MeetingParticipants({
*/
function _mapStateToProps(state: IReduxState) {
let sortedParticipantIds: any = getSortedParticipantIds(state);
+ const _iAmVisitor = iAmVisitor(state);
// Filter out the virtual screenshare participants since we do not want them to be displayed as separate
// participants in the participants pane.
+ // Filter local participant when in visitor mode
sortedParticipantIds = sortedParticipantIds.filter((id: any) => {
const participant = getParticipantById(state, id);
+ if (_iAmVisitor && participant?.local) {
+ return false;
+ }
+
return !isScreenShareParticipant(participant);
});
diff --git a/react/features/toolbox/components/native/OverflowMenu.tsx b/react/features/toolbox/components/native/OverflowMenu.tsx
index 1e94811c84..6677519d41 100644
--- a/react/features/toolbox/components/native/OverflowMenu.tsx
+++ b/react/features/toolbox/components/native/OverflowMenu.tsx
@@ -23,6 +23,7 @@ import SpeakerStatsButton from '../../../speaker-stats/components/native/Speaker
import { isSpeakerStatsDisabled } from '../../../speaker-stats/functions';
import ClosedCaptionButton from '../../../subtitles/components/native/ClosedCaptionButton';
import styles from '../../../video-menu/components/native/styles';
+import { iAmVisitor } from '../../../visitors/functions';
import WhiteboardButton from '../../../whiteboard/components/native/WhiteboardButton';
import { customButtonPressed } from '../../actions.native';
import { getVisibleNativeButtons } from '../../functions.native';
@@ -292,6 +293,7 @@ export default connect(_mapStateToProps)(props => {
mainToolbarButtonsThresholds,
toolbarButtons
} = useSelector((state: IReduxState) => state['features/toolbox']);
+ const _iAmVisitor = useSelector(iAmVisitor);
const allButtons = useNativeToolboxButtons(customToolbarButtons);
@@ -299,7 +301,8 @@ export default connect(_mapStateToProps)(props => {
allButtons,
clientWidth,
mainToolbarButtonsThresholds,
- toolbarButtons
+ toolbarButtons,
+ iAmVisitor: _iAmVisitor
});
return (
diff --git a/react/features/toolbox/components/native/Toolbox.tsx b/react/features/toolbox/components/native/Toolbox.tsx
index 2c793af44f..0d97377988 100644
--- a/react/features/toolbox/components/native/Toolbox.tsx
+++ b/react/features/toolbox/components/native/Toolbox.tsx
@@ -70,6 +70,7 @@ function Toolbox(props: IProps) {
const { mainMenuButtons } = getVisibleNativeButtons({
allButtons,
clientWidth,
+ iAmVisitor: _iAmVisitor,
mainToolbarButtonsThresholds,
toolbarButtons
});
diff --git a/react/features/toolbox/constants.ts b/react/features/toolbox/constants.ts
index 102924f84c..9e664d04a3 100644
--- a/react/features/toolbox/constants.ts
+++ b/react/features/toolbox/constants.ts
@@ -205,6 +205,7 @@ export const VISITORS_MODE_BUTTONS: ToolbarButton[] = [
'closedcaptions',
'fullscreen',
'hangup',
+ 'participants-pane',
'raisehand',
'settings',
'stats',
diff --git a/react/features/toolbox/functions.native.ts b/react/features/toolbox/functions.native.ts
index 90693ea54d..41155e5cdc 100644
--- a/react/features/toolbox/functions.native.ts
+++ b/react/features/toolbox/functions.native.ts
@@ -7,7 +7,7 @@ import { getParticipantCountWithFake } from '../base/participants/functions';
import { toState } from '../base/redux/functions';
import { isLocalVideoTrackDesktop } from '../base/tracks/functions.native';
-import { MAIN_TOOLBAR_BUTTONS_PRIORITY } from './constants';
+import { MAIN_TOOLBAR_BUTTONS_PRIORITY, VISITORS_MODE_BUTTONS } from './constants';
import { isButtonEnabled } from './functions.any';
import { IGetVisibleNativeButtonsParams, IToolboxNativeButton } from './types';
@@ -67,11 +67,15 @@ export function isVideoMuteButtonDisabled(state: IReduxState) {
* @returns {Object} - The visible buttons arrays .
*/
export function getVisibleNativeButtons(
- { allButtons, clientWidth, mainToolbarButtonsThresholds, toolbarButtons }: IGetVisibleNativeButtonsParams) {
- const filteredButtons = Object.keys(allButtons).filter(key =>
+ { allButtons, clientWidth, iAmVisitor, mainToolbarButtonsThresholds, toolbarButtons }: IGetVisibleNativeButtonsParams) {
+ let filteredButtons = Object.keys(allButtons).filter(key =>
typeof key !== 'undefined' // filter invalid buttons that may be coming from config.mainToolbarButtons override
&& isButtonEnabled(key, toolbarButtons));
+ if (iAmVisitor) {
+ filteredButtons = VISITORS_MODE_BUTTONS.filter(button => filteredButtons.indexOf(button) > -1);
+ }
+
const { order } = mainToolbarButtonsThresholds.find(({ width }) => clientWidth > width)
|| mainToolbarButtonsThresholds[mainToolbarButtonsThresholds.length - 1];
diff --git a/react/features/toolbox/hooks.native.ts b/react/features/toolbox/hooks.native.ts
index 70bb6ea1bc..466d58c343 100644
--- a/react/features/toolbox/hooks.native.ts
+++ b/react/features/toolbox/hooks.native.ts
@@ -95,11 +95,7 @@ function getVideoMuteButton() {
* @returns {Object | undefined}
*/
function getChatButton() {
- const _iAmVisitor = useSelector(iAmVisitor);
-
- if (!_iAmVisitor) {
- return chat;
- }
+ return chat;
}
/**
@@ -122,11 +118,7 @@ function getScreenSharingButton() {
* @returns {Object | undefined}
*/
function getTileViewButton() {
- const _iAmVisitor = useSelector(iAmVisitor);
-
- if (!_iAmVisitor) {
- return tileview;
- }
+ return tileview;
}
/**
@@ -135,11 +127,7 @@ function getTileViewButton() {
* @returns {Object | undefined}
*/
function getOverflowMenuButton() {
- const _iAmVisitor = useSelector(iAmVisitor);
-
- if (!_iAmVisitor) {
- return overflowmenu;
- }
+ return overflowmenu;
}
/**
diff --git a/react/features/toolbox/types.ts b/react/features/toolbox/types.ts
index 4860aaac51..f3700879c5 100644
--- a/react/features/toolbox/types.ts
+++ b/react/features/toolbox/types.ts
@@ -92,6 +92,7 @@ export type NativeToolbarButton = 'camera' |
export interface IGetVisibleNativeButtonsParams {
allButtons: { [key: string]: IToolboxNativeButton; };
clientWidth: number;
+ iAmVisitor: boolean;
mainToolbarButtonsThresholds: IMainToolbarButtonThresholds;
toolbarButtons: string[];
}
diff --git a/react/features/visitors/components/native/VisitorsCountLabel.tsx b/react/features/visitors/components/native/VisitorsCountLabel.tsx
index cdacd51edd..02a6076d34 100644
--- a/react/features/visitors/components/native/VisitorsCountLabel.tsx
+++ b/react/features/visitors/components/native/VisitorsCountLabel.tsx
@@ -1,11 +1,10 @@
import React from 'react';
import { useSelector } from 'react-redux';
-import { IReduxState } from '../../../app/types';
import { IconUsers } from '../../../base/icons/svg';
import Label from '../../../base/label/components/native/Label';
import BaseTheme from '../../../base/ui/components/BaseTheme.native';
-import { getVisitorsCount, getVisitorsShortText, iAmVisitor } from '../../functions';
+import { getVisitorsCount, getVisitorsShortText } from '../../functions';
const styles = {
raisedHandsCountLabel: {
@@ -24,10 +23,9 @@ const styles = {
};
const VisitorsCountLabel = () => {
- const visitorsMode = useSelector((state: IReduxState) => iAmVisitor(state));
const visitorsCount = useSelector(getVisitorsCount);
- return !visitorsMode && visitorsCount > 0 ? (
+ return visitorsCount > 0 ? (
<Label
icon = { IconUsers }
iconColor = { BaseTheme.palette.uiBackground }
diff --git a/react/features/visitors/components/web/VisitorsCountLabel.tsx b/react/features/visitors/components/web/VisitorsCountLabel.tsx
index e1d852dfce..edc6ee585d 100644
--- a/react/features/visitors/components/web/VisitorsCountLabel.tsx
+++ b/react/features/visitors/components/web/VisitorsCountLabel.tsx
@@ -3,11 +3,10 @@ import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { makeStyles } from 'tss-react/mui';
-import { IReduxState } from '../../../app/types';
import { IconUsers } from '../../../base/icons/svg';
import Label from '../../../base/label/components/web/Label';
import Tooltip from '../../../base/tooltip/components/Tooltip';
-import { getVisitorsCount, getVisitorsShortText, iAmVisitor } from '../../functions';
+import { getVisitorsCount, getVisitorsShortText } from '../../functions';
const useStyles = makeStyles()(theme => {
return {
@@ -20,11 +19,10 @@ const useStyles = makeStyles()(theme => {
const VisitorsCountLabel = () => {
const { classes: styles, theme } = useStyles();
- const visitorsMode = useSelector((state: IReduxState) => iAmVisitor(state));
const visitorsCount = useSelector(getVisitorsCount);
const { t } = useTranslation();
- return !visitorsMode && visitorsCount > 0 ? (<Tooltip
+ return visitorsCount > 0 ? (<Tooltip
content = { t('visitors.labelTooltip', { count: visitorsCount }) }
position = { 'bottom' }>
<Label