mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { MainContainer } from '@affine/component/workspace';
|
|
import { NoSsr } from '@mui/material';
|
|
import { affinePluginsAtom } from '@toeverything/plugin-infra/manager';
|
|
import { useAtomValue } from 'jotai';
|
|
import type { ReactElement } from 'react';
|
|
import { Suspense } from 'react';
|
|
|
|
import { AppContainer } from '../components/affine/app-container';
|
|
|
|
const Plugins = () => {
|
|
const plugins = useAtomValue(affinePluginsAtom);
|
|
return (
|
|
<NoSsr>
|
|
<div>
|
|
{Object.values(plugins).map(({ definition, uiAdapter }) => {
|
|
const Content = uiAdapter.debugContent;
|
|
return (
|
|
<div key={definition.id}>
|
|
{/* todo: support i18n */}
|
|
{definition.name.fallback}
|
|
{Content && <Content />}
|
|
</div>
|
|
);
|
|
})}
|
|
</div>
|
|
</NoSsr>
|
|
);
|
|
};
|
|
|
|
export default function PluginPage(): ReactElement {
|
|
if (!runtimeConfig.enablePlugin) {
|
|
return <></>;
|
|
}
|
|
return (
|
|
<AppContainer>
|
|
<MainContainer>
|
|
<Suspense>
|
|
<Plugins />
|
|
</Suspense>
|
|
</MainContainer>
|
|
</AppContainer>
|
|
);
|
|
}
|