bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/plugins-engine/ui-commands/chat/handler.tsx
Guilherme Pereira Leme 4f505d7122
feat(plugin): added support for plugin ui commands. (#19326)
* [plugin-sdk-ui-commands] - implemented chat ui command for plugin

* [plugin-sdk-ui-commands] - update SDK

* plugin-sdk-ui-commands
2023-12-15 14:04:52 -03:00

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;