Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
import { CONFERENCE_LEFT } from '../base/conference/actionTypes';
import PersistenceRegistry from '../base/redux/PersistenceRegistry';
import ReducerRegistry from '../base/redux/ReducerRegistry';
import {
CUSTOM_PANEL_CLOSE,
CUSTOM_PANEL_OPEN,
SET_CUSTOM_PANEL_ADVISOR_AVAILABLE,
SET_CUSTOM_PANEL_IS_RESIZING,
SET_CUSTOM_PANEL_WIDTH,
SET_USER_CUSTOM_PANEL_WIDTH
} from './actionTypes';
import { DEFAULT_CUSTOM_PANEL_WIDTH } from './constants';
/**
* The state of the custom panel feature.
*/
export interface ICustomPanelState {
/**
* Whether advisor-resolve confirmed an advisor for the current meeting.
*/
isAdvisorAvailable: boolean;
/**
* Whether the custom panel is currently open.
*/
isOpen: boolean;
/**
* Whether the user is currently resizing the custom panel.
*/
isResizing: boolean;
/**
* The width state of the custom panel.
*/
width: {
/**
* The current display width in pixels.
*/
current: number;
/**
* The user-preferred width set via drag resize, or null if not set.
*/
userSet: number | null;
};
}
const DEFAULT_STATE: ICustomPanelState = {
isAdvisorAvailable: false,
isOpen: false,
isResizing: false,
width: {
current: DEFAULT_CUSTOM_PANEL_WIDTH,
userSet: null
}
};
/**
* Persist the width subtree, so the user's preferred panel width survives page reloads.
*/
PersistenceRegistry.register('features/custom-panel', {
width: true
});
/**
* Listen for actions that mutate the custom panel state.
*/
ReducerRegistry.register(
'features/custom-panel', (state: ICustomPanelState = DEFAULT_STATE, action): ICustomPanelState => {
switch (action.type) {
case CONFERENCE_LEFT:
return {
...state,
isAdvisorAvailable: false
};
case CUSTOM_PANEL_CLOSE:
return {
...state,
isOpen: false
};
case CUSTOM_PANEL_OPEN:
return {
...state,
isOpen: true
};
case SET_CUSTOM_PANEL_ADVISOR_AVAILABLE:
return {
...state,
isAdvisorAvailable: action.available
};
case SET_CUSTOM_PANEL_WIDTH:
return {
...state,
width: {
...state.width,
current: action.width
}
};
case SET_USER_CUSTOM_PANEL_WIDTH:
return {
...state,
width: {
current: action.width,
userSet: action.width
}
};
case SET_CUSTOM_PANEL_IS_RESIZING:
return {
...state,
isResizing: action.resizing
};
default:
return state;
}
}
);