From 7de2f749b14ed6481fe30e8b06ad8dbcc6654868 Mon Sep 17 00:00:00 2001 From: sealday Date: Sun, 17 Mar 2024 12:29:29 +0800 Subject: [PATCH] refactor: pages import styles --- packages/plugins/@hera/plugin-core/src/client/index.tsx | 8 ++------ .../client/{layouts/index.tsx => pages/AdminLayout.tsx} | 2 +- .../@hera/plugin-core/src/client/pages/DetailsPage.tsx | 2 +- .../plugins/@hera/plugin-core/src/client/pages/Home.tsx | 2 +- .../plugins/@hera/plugin-core/src/client/pages/index.ts | 6 ++++++ 5 files changed, 11 insertions(+), 9 deletions(-) rename packages/plugins/@hera/plugin-core/src/client/{layouts/index.tsx => pages/AdminLayout.tsx} (99%) create mode 100644 packages/plugins/@hera/plugin-core/src/client/pages/index.ts diff --git a/packages/plugins/@hera/plugin-core/src/client/index.tsx b/packages/plugins/@hera/plugin-core/src/client/index.tsx index 0ffb5f89b..a9bde0dee 100644 --- a/packages/plugins/@hera/plugin-core/src/client/index.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/index.tsx @@ -8,16 +8,12 @@ import { SchemaSettingOptions, useCollection, } from '@nocobase/client'; -import { HeraAdminLayout } from './layouts'; import { remove } from 'lodash'; import { CalendarBlockInitializer } from './schema-initializer/CalendarBlockInitializer'; import { MenuDesigner } from './components/ExtendedMenuDesigner'; import { SessionSubmit, SessionUpdate } from './components/ExtendedActionDesigner'; -import { DetailsPage } from './pages/DetailsPage'; -import { OutboundPage } from './pages/OutboundPage'; import { HomePageConfiguration } from './pages/HomePageConfiguration'; import { Configuration } from './components/TokenConfiguration'; -import { HomePage } from './pages/Home'; import { InternalPDFViewer } from './schema-components/PDFViewer'; import { PDFViewerBlockInitializer, @@ -34,7 +30,6 @@ import { FilterAssociatedFields } from './schema-initializer/FilterAssociatedFie import { useFieldSchema } from '@formily/react'; import { isValid } from '@formily/shared'; import { useCreateActionProps } from './hooks/useCreateActionProps'; -import { PageLayout } from './pages/PageLayout'; import { useOutboundActionProps } from './hooks/useOutboundActionProps'; import { ExtendedAssociationField } from './schema-components/association-field/Editable'; import { AssociatedField } from './components/AssociatedField'; @@ -87,6 +82,7 @@ import { CustomField } from './components/CustomField'; import { useGetCustomAssociatedComponents } from './hooks/useGetCustomAssociatedComponents'; import { useGetCustomComponents } from './hooks/useGetCustomComponents'; import { AutoComplete } from './schema-components/AutoComplete/AutoComplete'; +import { AdminLayout, DetailsPage, HomePage, OutboundPage, PageLayout } from './pages'; export { usePDFViewerRef } from './schema-initializer/PDFVIewerBlockInitializer'; export * from './custom-components'; @@ -165,7 +161,7 @@ export class PluginCoreClient extends Plugin { OutboundLinkActionInitializer, PDFViewerBlockInitializer, PDFViwer: InternalPDFViewer, - AdminLayout: HeraAdminLayout, + AdminLayout, ExtendedCalendarBlockInitializer: CalendarBlockInitializer, SettingBlock: SettingBlockInitializer, CreateSubmitActionInitializer, diff --git a/packages/plugins/@hera/plugin-core/src/client/layouts/index.tsx b/packages/plugins/@hera/plugin-core/src/client/pages/AdminLayout.tsx similarity index 99% rename from packages/plugins/@hera/plugin-core/src/client/layouts/index.tsx rename to packages/plugins/@hera/plugin-core/src/client/pages/AdminLayout.tsx index c0954df59..a64c38f80 100644 --- a/packages/plugins/@hera/plugin-core/src/client/layouts/index.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/pages/AdminLayout.tsx @@ -451,7 +451,7 @@ const usePageStyle = () => { return useContext(PageStyleContext).style; }; -export const HeraAdminLayout = (props) => { +export const AdminLayout = (props) => { const { addMenuItem } = useCurrentUserSettingsMenu(); const [style, setStyle] = useState('classical'); const tabItem = useTabSettings({ style, setStyle }); diff --git a/packages/plugins/@hera/plugin-core/src/client/pages/DetailsPage.tsx b/packages/plugins/@hera/plugin-core/src/client/pages/DetailsPage.tsx index e1f5c9baf..3d90eb8d2 100644 --- a/packages/plugins/@hera/plugin-core/src/client/pages/DetailsPage.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/pages/DetailsPage.tsx @@ -8,7 +8,7 @@ import { } from '@nocobase/client'; import { useNavigate, useParams } from 'react-router-dom'; import pathToRegexp from 'path-to-regexp'; -import { useHeadStyles } from '../pages/style'; +import { useHeadStyles } from './style'; import { PageHeader as AntdPageHeader } from '@ant-design/pro-layout'; export const DetailsPage: React.FC = () => { diff --git a/packages/plugins/@hera/plugin-core/src/client/pages/Home.tsx b/packages/plugins/@hera/plugin-core/src/client/pages/Home.tsx index 07d7f1073..501292dfc 100644 --- a/packages/plugins/@hera/plugin-core/src/client/pages/Home.tsx +++ b/packages/plugins/@hera/plugin-core/src/client/pages/Home.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { useStyles } from './style'; import { Carousel, Image } from 'antd'; import { useRequest } from '@nocobase/client'; -import { useAppSpin } from '../layouts'; +import { useAppSpin } from './AdminLayout'; export const HomePage: React.FC<{}> = () => { const { styles } = useStyles(); diff --git a/packages/plugins/@hera/plugin-core/src/client/pages/index.ts b/packages/plugins/@hera/plugin-core/src/client/pages/index.ts new file mode 100644 index 000000000..47581e60c --- /dev/null +++ b/packages/plugins/@hera/plugin-core/src/client/pages/index.ts @@ -0,0 +1,6 @@ +export * from './AdminLayout'; +export * from './DetailsPage'; +export * from './Home'; +export * from './HomePageConfiguration'; +export * from './OutboundPage'; +export * from './PageLayout';