4f505d7122
* [plugin-sdk-ui-commands] - implemented chat ui command for plugin * [plugin-sdk-ui-commands] - update SDK * plugin-sdk-ui-commands
33 lines
889 B
TypeScript
33 lines
889 B
TypeScript
import { useEffect } from 'react';
|
|
import {
|
|
ChatFormCommandsEnum,
|
|
} from 'bigbluebutton-html-plugin-sdk/dist/cjs/ui-commands/chat/form/enums';
|
|
import { layoutDispatch } from '../../../layout/context';
|
|
import { PANELS, ACTIONS } from '../../../layout/enums';
|
|
|
|
const PluginChatUiCommandsHandler = () => {
|
|
const layoutContextDispatch = layoutDispatch();
|
|
|
|
const handleChatFormsOpen = () => {
|
|
layoutContextDispatch({
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
value: true,
|
|
});
|
|
layoutContextDispatch({
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
value: PANELS.CHAT,
|
|
});
|
|
};
|
|
|
|
useEffect(() => {
|
|
window.addEventListener(ChatFormCommandsEnum.OPEN, handleChatFormsOpen);
|
|
|
|
return () => {
|
|
window.addEventListener(ChatFormCommandsEnum.OPEN, handleChatFormsOpen);
|
|
};
|
|
}, []);
|
|
return null;
|
|
};
|
|
|
|
export default PluginChatUiCommandsHandler;
|