jiti-meet/react/features/video-layout/reducer.ts

66 lines
1.5 KiB
TypeScript
Raw Normal View History

2022-09-01 11:00:49 +00:00
import ReducerRegistry from '../base/redux/ReducerRegistry';
import {
SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED,
SET_CAR_MODE,
SET_TILE_VIEW,
VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED
} from './actionTypes';
const DEFAULT_STATE = {
/**
* Whether we are in carmode.
*
* @public
* @type {boolean}
*/
carMode: false,
remoteScreenShares: [],
/**
* The indicator which determines whether the video layout should display
* video thumbnails in a tiled layout.
*
2020-07-23 13:12:25 +00:00
* Note: undefined means that the user hasn't requested anything in particular yet, so
* we use our auto switching rules.
*
* @public
* @type {boolean}
*/
2020-07-23 13:12:25 +00:00
tileViewEnabled: undefined
};
2022-09-01 11:00:49 +00:00
export interface IVideoLayoutState {
carMode: boolean;
remoteScreenShares: string[];
tileViewEnabled?: boolean;
}
const STORE_NAME = 'features/video-layout';
2022-09-05 09:05:07 +00:00
ReducerRegistry.register<IVideoLayoutState>(STORE_NAME, (state = DEFAULT_STATE, action): IVideoLayoutState => {
switch (action.type) {
case SCREEN_SHARE_REMOTE_PARTICIPANTS_UPDATED:
case VIRTUAL_SCREENSHARE_REMOTE_PARTICIPANTS_UPDATED:
return {
...state,
remoteScreenShares: action.participantIds
};
case SET_CAR_MODE:
return {
...state,
carMode: action.enabled
};
case SET_TILE_VIEW:
return {
...state,
tileViewEnabled: action.enabled
};
}
return state;
});