2023-07-07 14:35:22 +08:00
|
|
|
import { PluginManagerContext, SettingsCenterContext, SettingsCenterProvider } from '@nocobase/client';
|
2023-01-11 11:58:47 +08:00
|
|
|
import React, { useContext } from 'react';
|
2023-06-14 09:35:09 +08:00
|
|
|
import { GraphCollectionPane } from './GraphCollectionShortcut';
|
2023-01-13 10:55:04 +08:00
|
|
|
import { useGCMTranslation } from './utils';
|
2023-01-11 11:58:47 +08:00
|
|
|
|
|
|
|
export const GraphCollectionProvider = React.memo((props) => {
|
|
|
|
const ctx = useContext(PluginManagerContext);
|
2023-01-13 10:55:04 +08:00
|
|
|
const { t } = useGCMTranslation();
|
2023-01-11 11:58:47 +08:00
|
|
|
const items = useContext(SettingsCenterContext);
|
|
|
|
|
|
|
|
items['collection-manager']['tabs']['graph'] = {
|
2023-04-25 13:12:14 +08:00
|
|
|
title: t('Graphical interface'),
|
2023-01-11 11:58:47 +08:00
|
|
|
component: GraphCollectionPane,
|
2023-04-25 13:12:14 +08:00
|
|
|
};
|
2023-01-11 11:58:47 +08:00
|
|
|
|
|
|
|
return (
|
2023-04-25 13:12:14 +08:00
|
|
|
<SettingsCenterProvider settings={items}>
|
2023-01-11 11:58:47 +08:00
|
|
|
<PluginManagerContext.Provider
|
|
|
|
value={{
|
|
|
|
components: {
|
|
|
|
...ctx?.components,
|
|
|
|
},
|
|
|
|
}}
|
|
|
|
>
|
2023-07-07 14:35:22 +08:00
|
|
|
{props.children}
|
2023-01-11 11:58:47 +08:00
|
|
|
</PluginManagerContext.Provider>
|
|
|
|
</SettingsCenterProvider>
|
|
|
|
);
|
|
|
|
});
|
2023-06-06 19:33:04 +08:00
|
|
|
GraphCollectionProvider.displayName = 'GraphCollectionProvider';
|