Skip to content

Commit

Permalink
chore(tileview) Add config for disabling tileview (#13692)
Browse files Browse the repository at this point in the history
- show fixed number of toolbar buttons in toolbar (including custom buttons) instead of sending to overflow menu
  • Loading branch information
horymury committed Aug 18, 2023
1 parent 9b7db68 commit 1134634
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 10 deletions.
2 changes: 2 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,8 @@ var config = {

// Tile view related config options.
// tileView: {
// // Whether tileview should be disabled.
// disabled: false,
// // The optimal number of tiles that are going to be shown in tile view. Depending on the screen size it may
// // not be possible to show the exact number of participants specified here.
// numberOfVisibleTiles: 25,
Expand Down
1 change: 1 addition & 0 deletions react/features/base/config/configType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ export interface IConfig {
testMode?: boolean;
};
tileView?: {
disabled?: boolean;
numberOfVisibleTiles?: number;
};
tokenAuthUrl?: string;
Expand Down
1 change: 1 addition & 0 deletions react/features/base/ui/constants.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ export const commonStyles = (theme: Theme) => {
padding: 6,
textAlign: 'center' as const,
pointerEvents: 'all' as const,
display: 'flex',
boxShadow: '0px 2px 8px 4px rgba(0, 0, 0, 0.25), 0px 0px 0px 1px rgba(0, 0, 0, 0.15)',

'& > div': {
Expand Down
14 changes: 13 additions & 1 deletion react/features/filmstrip/functions.any.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IStore } from '../app/types';
import { IReduxState, IStore } from '../app/types';
import {
getActiveSpeakersToBeDisplayed,
getVirtualScreenshareParticipantOwnerId
Expand Down Expand Up @@ -95,3 +95,15 @@ export function updateRemoteParticipantsOnLeave(store: IStore, participantId: st
reorderedParticipants.delete(participantId)
&& store.dispatch(setRemoteParticipants(Array.from(reorderedParticipants)));
}

/**
* Returns whether tileview is completely disabled.
*
* @param {IReduxState} state - Redux state.
* @returns {boolean} - Whether tileview is completely disabled.
*/
export function isTileViewModeDisabled(state: IReduxState) {
const { tileView = {} } = state['features/base/config'];

return tileView.disabled;
}
7 changes: 2 additions & 5 deletions react/features/toolbox/components/web/Toolbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ const Toolbox = ({

setButtonsNotifyClickMode(buttons);
const isHangupVisible = isToolbarButtonEnabled('hangup', _toolbarButtons);
let { order } = THRESHOLDS.find(({ width }) => _clientWidth > width)
const { order } = THRESHOLDS.find(({ width }) => _clientWidth > width)
|| THRESHOLDS[THRESHOLDS.length - 1];

const keys = Object.keys(buttons);
Expand All @@ -302,11 +302,8 @@ const Toolbox = ({
!_jwtDisabledButtons.includes(key)
&& (isToolbarButtonEnabled(key, _toolbarButtons) || isToolbarButtonEnabled(alias, _toolbarButtons))
);
const filteredKeys = filtered.map(button => button.key);

order = order.filter(key => filteredKeys.includes(buttons[key as keyof typeof buttons].key));

let sliceIndex = order.length + 2;
let sliceIndex = _overflowDrawer ? order.length + 2 : order.length + 1;

if (isHangupVisible) {
sliceIndex -= 1;
Expand Down
11 changes: 8 additions & 3 deletions react/features/video-layout/actions.any.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IStore } from '../app/types';
import { isTileViewModeDisabled } from '../filmstrip/functions.any';

import {
SET_TILE_VIEW,
Expand Down Expand Up @@ -34,9 +35,13 @@ export function virtualScreenshareParticipantsUpdated(participantIds: Array<stri
* }}
*/
export function setTileView(enabled?: boolean) {
return {
type: SET_TILE_VIEW,
enabled
return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
const tileViewDisabled = isTileViewModeDisabled(getState());

!tileViewDisabled && dispatch({
type: SET_TILE_VIEW,
enabled
});
};
}

Expand Down
8 changes: 7 additions & 1 deletion react/features/video-layout/functions.any.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getFeatureFlag } from '../base/flags/functions';
import { pinParticipant } from '../base/participants/actions';
import { getParticipantCount, getPinnedParticipant } from '../base/participants/functions';
import { FakeParticipant } from '../base/participants/types';
import { isStageFilmstripAvailable } from '../filmstrip/functions';
import { isStageFilmstripAvailable, isTileViewModeDisabled } from '../filmstrip/functions';
import { isVideoPlaying } from '../shared-video/functions';
import { VIDEO_QUALITY_LEVELS } from '../video-quality/constants';
import { getReceiverVideoQualityLevel } from '../video-quality/functions';
Expand Down Expand Up @@ -60,6 +60,12 @@ export function getCurrentLayout(state: IReduxState) {
* @returns {boolean} True if tile view should be displayed.
*/
export function shouldDisplayTileView(state: IReduxState) {
const tileViewDisabled = isTileViewModeDisabled(state);

if (tileViewDisabled) {
return false;
}

const { tileViewEnabled } = state['features/video-layout'] ?? {};

if (tileViewEnabled !== undefined) {
Expand Down

0 comments on commit 1134634

Please sign in to comment.