2023-09-05 20:49:55 +08:00
|
|
|
import * as React from 'react';
|
2023-08-16 06:31:11 +08:00
|
|
|
import * as PluginSdk from 'bigbluebutton-html-plugin-sdk';
|
2023-09-05 20:49:55 +08:00
|
|
|
|
2023-09-11 21:12:37 +08:00
|
|
|
import { PluginProvidedStateContainerProps, PluginsProvidedStateMap, PluginProvidedState } from '../types';
|
2023-09-05 20:49:55 +08:00
|
|
|
import PresentationToolbarPluginStateContainer from './presentation-toolbar/container';
|
|
|
|
import UserListDropdownPluginStateContainer from './user-list-dropdown/container';
|
2023-08-16 06:31:11 +08:00
|
|
|
|
|
|
|
const pluginProvidedStateMap: PluginsProvidedStateMap = {};
|
|
|
|
|
|
|
|
function generateItemWithId<T extends PluginSdk.PluginProvidedUiItemDescriptor>(
|
|
|
|
item: T, index: number,
|
|
|
|
): T {
|
2023-09-05 20:49:55 +08:00
|
|
|
item.setItemId(`${index}`);
|
|
|
|
return item;
|
2023-08-16 06:31:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const PluginProvidedStateContainer = (props: PluginProvidedStateContainerProps) => {
|
|
|
|
const {
|
|
|
|
uuid,
|
|
|
|
} = props;
|
|
|
|
if (!pluginProvidedStateMap[uuid]) {
|
|
|
|
pluginProvidedStateMap[uuid] = {} as PluginProvidedState;
|
|
|
|
}
|
|
|
|
const pluginApi: PluginSdk.PluginApi = PluginSdk.getPluginApi(uuid);
|
2023-09-05 20:49:55 +08:00
|
|
|
const pluginProvidedStateChildrenProps = {
|
|
|
|
uuid,
|
|
|
|
generateItemWithId,
|
|
|
|
pluginProvidedStateMap,
|
|
|
|
pluginApi,
|
2023-08-16 06:31:11 +08:00
|
|
|
};
|
2023-09-05 20:49:55 +08:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<PresentationToolbarPluginStateContainer
|
|
|
|
{ ...pluginProvidedStateChildrenProps}
|
|
|
|
/>
|
|
|
|
<UserListDropdownPluginStateContainer
|
|
|
|
{ ...pluginProvidedStateChildrenProps}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
2023-08-16 06:31:11 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export default PluginProvidedStateContainer;
|