Files
upstream-jitsi-meet/react/features/whiteboard/reducer.ts
upstream-mirror 1d2bfcac0c
Some checks failed
Prosody Plugin Tests / test (push) Failing after 10m11s
Close stale issues and PRs / stale (push) Failing after 1s
snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
2026-09-15 15:56:32 +05:00

78 lines
1.7 KiB
TypeScript

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;
});