refactor: move component into UI part (#1333)
This commit is contained in:
@@ -39,12 +39,12 @@ const WorkspaceDetail: React.FC = () => {
|
|||||||
return <PageLoading />;
|
return <PageLoading />;
|
||||||
}
|
}
|
||||||
if (currentWorkspace.flavour === RemWorkspaceFlavour.AFFINE) {
|
if (currentWorkspace.flavour === RemWorkspaceFlavour.AFFINE) {
|
||||||
const PageDetail = WorkspacePlugins[currentWorkspace.flavour].PageDetail;
|
const PageDetail = WorkspacePlugins[currentWorkspace.flavour].UI.PageDetail;
|
||||||
return (
|
return (
|
||||||
<PageDetail currentWorkspace={currentWorkspace} currentPageId={pageId} />
|
<PageDetail currentWorkspace={currentWorkspace} currentPageId={pageId} />
|
||||||
);
|
);
|
||||||
} else if (currentWorkspace.flavour === RemWorkspaceFlavour.LOCAL) {
|
} else if (currentWorkspace.flavour === RemWorkspaceFlavour.LOCAL) {
|
||||||
const PageDetail = WorkspacePlugins[currentWorkspace.flavour].PageDetail;
|
const PageDetail = WorkspacePlugins[currentWorkspace.flavour].UI.PageDetail;
|
||||||
return (
|
return (
|
||||||
<PageDetail currentWorkspace={currentWorkspace} currentPageId={pageId} />
|
<PageDetail currentWorkspace={currentWorkspace} currentPageId={pageId} />
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const AllPage: NextPageWithLayout = () => {
|
|||||||
return <PageLoading />;
|
return <PageLoading />;
|
||||||
}
|
}
|
||||||
if (currentWorkspace.flavour === RemWorkspaceFlavour.AFFINE) {
|
if (currentWorkspace.flavour === RemWorkspaceFlavour.AFFINE) {
|
||||||
const PageList = WorkspacePlugins[currentWorkspace.flavour].PageList;
|
const PageList = WorkspacePlugins[currentWorkspace.flavour].UI.PageList;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WorkspaceTitle icon={<FolderIcon />}>{t('All pages')}</WorkspaceTitle>
|
<WorkspaceTitle icon={<FolderIcon />}>{t('All pages')}</WorkspaceTitle>
|
||||||
@@ -58,7 +58,7 @@ const AllPage: NextPageWithLayout = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
} else if (currentWorkspace.flavour === RemWorkspaceFlavour.LOCAL) {
|
} else if (currentWorkspace.flavour === RemWorkspaceFlavour.LOCAL) {
|
||||||
const PageList = WorkspacePlugins[currentWorkspace.flavour].PageList;
|
const PageList = WorkspacePlugins[currentWorkspace.flavour].UI.PageList;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WorkspaceTitle icon={<FolderIcon />}>{t('All pages')}</WorkspaceTitle>
|
<WorkspaceTitle icon={<FolderIcon />}>{t('All pages')}</WorkspaceTitle>
|
||||||
|
|||||||
@@ -120,7 +120,8 @@ const SettingPage: NextPageWithLayout = () => {
|
|||||||
} else if (settingPanelValues.indexOf(currentTab as SettingPanel) === -1) {
|
} else if (settingPanelValues.indexOf(currentTab as SettingPanel) === -1) {
|
||||||
return <PageLoading />;
|
return <PageLoading />;
|
||||||
} else if (currentWorkspace.flavour === RemWorkspaceFlavour.AFFINE) {
|
} else if (currentWorkspace.flavour === RemWorkspaceFlavour.AFFINE) {
|
||||||
const Setting = WorkspacePlugins[currentWorkspace.flavour].SettingsDetail;
|
const Setting =
|
||||||
|
WorkspacePlugins[currentWorkspace.flavour].UI.SettingsDetail;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
@@ -139,7 +140,8 @@ const SettingPage: NextPageWithLayout = () => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
} else if (currentWorkspace.flavour === RemWorkspaceFlavour.LOCAL) {
|
} else if (currentWorkspace.flavour === RemWorkspaceFlavour.LOCAL) {
|
||||||
const Setting = WorkspacePlugins[currentWorkspace.flavour].SettingsDetail;
|
const Setting =
|
||||||
|
WorkspacePlugins[currentWorkspace.flavour].UI.SettingsDetail;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<WorkspaceTitle icon={<SettingsIcon />}>
|
<WorkspaceTitle icon={<SettingsIcon />}>
|
||||||
|
|||||||
@@ -178,6 +178,7 @@ export const AffinePlugin: WorkspacePlugin<RemWorkspaceFlavour.AFFINE> = {
|
|||||||
return [...allWorkspaces];
|
return [...allWorkspaces];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
UI: {
|
||||||
PageDetail: ({ currentWorkspace, currentPageId }) => {
|
PageDetail: ({ currentWorkspace, currentPageId }) => {
|
||||||
const page = currentWorkspace.blockSuiteWorkspace.getPage(currentPageId);
|
const page = currentWorkspace.blockSuiteWorkspace.getPage(currentPageId);
|
||||||
if (!page) {
|
if (!page) {
|
||||||
@@ -220,4 +221,5 @@ export const AffinePlugin: WorkspacePlugin<RemWorkspaceFlavour.AFFINE> = {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -51,12 +51,11 @@ export interface WorkspacePlugin<Flavour extends RemWorkspaceFlavour> {
|
|||||||
// update: (workspace: FlavourToWorkspace[Flavour]) => Promise<void>;
|
// update: (workspace: FlavourToWorkspace[Flavour]) => Promise<void>;
|
||||||
list: () => Promise<FlavourToWorkspace[Flavour][]>;
|
list: () => Promise<FlavourToWorkspace[Flavour][]>;
|
||||||
};
|
};
|
||||||
|
UI: {
|
||||||
//#region UI
|
|
||||||
PageDetail: React.FC<PageDetailProps<Flavour>>;
|
PageDetail: React.FC<PageDetailProps<Flavour>>;
|
||||||
PageList: React.FC<PageListProps<Flavour>>;
|
PageList: React.FC<PageListProps<Flavour>>;
|
||||||
SettingsDetail: React.FC<SettingProps<Flavour>>;
|
SettingsDetail: React.FC<SettingProps<Flavour>>;
|
||||||
//#endregion
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WorkspacePlugins = {
|
export const WorkspacePlugins = {
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ export const LocalPlugin: WorkspacePlugin<RemWorkspaceFlavour.LOCAL> = {
|
|||||||
return data;
|
return data;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
UI: {
|
||||||
PageDetail: ({ currentWorkspace, currentPageId }) => {
|
PageDetail: ({ currentWorkspace, currentPageId }) => {
|
||||||
const page = currentWorkspace.blockSuiteWorkspace.getPage(currentPageId);
|
const page = currentWorkspace.blockSuiteWorkspace.getPage(currentPageId);
|
||||||
if (!page) {
|
if (!page) {
|
||||||
@@ -146,4 +147,5 @@ export const LocalPlugin: WorkspacePlugin<RemWorkspaceFlavour.LOCAL> = {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user