2024-04-24 05:17:32 +08:00
|
|
|
import React from 'react';
|
2023-10-27 03:59:05 +08:00
|
|
|
import * as PluginSdk from 'bigbluebutton-html-plugin-sdk';
|
|
|
|
|
2024-01-31 05:38:09 +08:00
|
|
|
import { createChannelIdentifier } from 'bigbluebutton-html-plugin-sdk/dist/cjs/data-channel/utils';
|
2024-04-24 05:17:32 +08:00
|
|
|
import { DataChannelTypes } from 'bigbluebutton-html-plugin-sdk/dist/cjs/data-channel/enums';
|
2023-11-29 02:31:28 +08:00
|
|
|
|
2024-04-24 05:17:32 +08:00
|
|
|
import { DataChannelItemManagerReader } from './reader-manager';
|
|
|
|
import DataChannelItemManagerWriter from './writer-manager';
|
2023-10-27 03:59:05 +08:00
|
|
|
|
|
|
|
export interface DataChannelItemManagerProps {
|
2024-05-02 03:57:08 +08:00
|
|
|
identifier: string;
|
2023-10-27 03:59:05 +08:00
|
|
|
pluginName: string;
|
|
|
|
channelName: string;
|
2024-04-24 05:17:32 +08:00
|
|
|
subChannelName: string;
|
|
|
|
pluginApi: PluginSdk.PluginApi;
|
|
|
|
dataChannelTypes: DataChannelTypes[];
|
2023-10-27 03:59:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export const DataChannelItemManager: React.ElementType<DataChannelItemManagerProps> = (
|
|
|
|
props: DataChannelItemManagerProps,
|
|
|
|
) => {
|
|
|
|
const {
|
2024-05-02 03:57:08 +08:00
|
|
|
identifier,
|
2023-10-27 03:59:05 +08:00
|
|
|
pluginName,
|
|
|
|
channelName,
|
2023-10-28 00:54:00 +08:00
|
|
|
pluginApi,
|
2024-04-24 05:17:32 +08:00
|
|
|
dataChannelTypes,
|
|
|
|
subChannelName,
|
2023-10-27 03:59:05 +08:00
|
|
|
} = props;
|
|
|
|
|
2024-04-24 05:17:32 +08:00
|
|
|
const dataChannelIdentifier = createChannelIdentifier(channelName, subChannelName, pluginName);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<DataChannelItemManagerWriter
|
|
|
|
{...{
|
|
|
|
pluginName,
|
|
|
|
channelName,
|
|
|
|
pluginApi,
|
|
|
|
dataChannelTypes,
|
|
|
|
subChannelName,
|
|
|
|
dataChannelIdentifier,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
{
|
|
|
|
dataChannelTypes.map((type) => (
|
|
|
|
<DataChannelItemManagerReader
|
|
|
|
{...{
|
2024-05-02 03:57:08 +08:00
|
|
|
key: identifier?.concat('::')?.concat(type),
|
2024-04-24 05:17:32 +08:00
|
|
|
pluginName,
|
|
|
|
channelName,
|
|
|
|
dataChannelType: type,
|
|
|
|
subChannelName,
|
|
|
|
dataChannelIdentifier,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
))
|
2024-01-31 05:38:09 +08:00
|
|
|
}
|
2024-04-24 05:17:32 +08:00
|
|
|
</>
|
|
|
|
);
|
2023-10-27 03:59:05 +08:00
|
|
|
};
|