snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
77
react/features/whiteboard/reducer.ts
Normal file
77
react/features/whiteboard/reducer.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import ReducerRegistry from '../base/redux/ReducerRegistry';
|
||||
|
||||
import { RESET_WHITEBOARD, SETUP_WHITEBOARD, SET_WHITEBOARD_OPEN } from './actionTypes';
|
||||
|
||||
export interface IWhiteboardState {
|
||||
|
||||
/**
|
||||
* The whiteboard collaboration details.
|
||||
*/
|
||||
collabDetails?: { roomId: string; roomKey: string; };
|
||||
|
||||
/**
|
||||
* The whiteboard collaboration url.
|
||||
*/
|
||||
collabServerUrl?: string;
|
||||
|
||||
/**
|
||||
* The indicator which determines whether the whiteboard is open.
|
||||
*
|
||||
* @type {boolean}
|
||||
*/
|
||||
isOpen: boolean;
|
||||
|
||||
}
|
||||
|
||||
const DEFAULT_STATE: IWhiteboardState = {
|
||||
isOpen: false,
|
||||
collabDetails: undefined,
|
||||
collabServerUrl: undefined
|
||||
};
|
||||
|
||||
export interface IWhiteboardAction extends Partial<IWhiteboardState> {
|
||||
|
||||
/**
|
||||
* The whiteboard collaboration details.
|
||||
*/
|
||||
collabDetails?: { roomId: string; roomKey: string; };
|
||||
|
||||
/**
|
||||
* The whiteboard collaboration url.
|
||||
*/
|
||||
collabServerUrl?: string;
|
||||
|
||||
/**
|
||||
* The action type.
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* Whether the action was triggered by a user interaction.
|
||||
*/
|
||||
userInitiated?: boolean;
|
||||
}
|
||||
|
||||
ReducerRegistry.register(
|
||||
'features/whiteboard',
|
||||
(state: IWhiteboardState = DEFAULT_STATE, action: IWhiteboardAction) => {
|
||||
switch (action.type) {
|
||||
case SETUP_WHITEBOARD: {
|
||||
return {
|
||||
...state,
|
||||
collabDetails: action.collabDetails,
|
||||
collabServerUrl: action.collabServerUrl
|
||||
};
|
||||
}
|
||||
case SET_WHITEBOARD_OPEN: {
|
||||
return {
|
||||
...state,
|
||||
isOpen: Boolean(action.isOpen)
|
||||
};
|
||||
}
|
||||
case RESET_WHITEBOARD:
|
||||
return DEFAULT_STATE;
|
||||
}
|
||||
|
||||
return state;
|
||||
});
|
||||
Reference in New Issue
Block a user