From 18874d0d1e0f6d7a3da9a68ed80cb25069a0a43d Mon Sep 17 00:00:00 2001 From: JimmFly Date: Mon, 3 Jul 2023 18:51:28 +0800 Subject: [PATCH] chore: add import to sidebar (#2981) --- .../root-app-sidebar/import-page.tsx | 22 +++++++++++++++++++ .../src/components/root-app-sidebar/index.tsx | 4 ++++ 2 files changed, 26 insertions(+) create mode 100644 apps/web/src/components/root-app-sidebar/import-page.tsx diff --git a/apps/web/src/components/root-app-sidebar/import-page.tsx b/apps/web/src/components/root-app-sidebar/import-page.tsx new file mode 100644 index 0000000000..52c0a96d0c --- /dev/null +++ b/apps/web/src/components/root-app-sidebar/import-page.tsx @@ -0,0 +1,22 @@ +import { MenuItem } from '@affine/component/app-sidebar'; +import { useAFFiNEI18N } from '@affine/i18n/hooks'; +import { ImportIcon } from '@blocksuite/icons'; + +import type { BlockSuiteWorkspace } from '../../shared'; +import { usePageHelper } from '../blocksuite/block-suite-page-list/utils'; + +const ImportPage = ({ + blocksuiteWorkspace, +}: { + blocksuiteWorkspace: BlockSuiteWorkspace; +}) => { + const t = useAFFiNEI18N(); + const { importFile } = usePageHelper(blocksuiteWorkspace); + return ( + } onClick={importFile}> + {t['Import']()} + + ); +}; + +export default ImportPage; diff --git a/apps/web/src/components/root-app-sidebar/index.tsx b/apps/web/src/components/root-app-sidebar/index.tsx index 2983901729..ea8e5bf911 100644 --- a/apps/web/src/components/root-app-sidebar/index.tsx +++ b/apps/web/src/components/root-app-sidebar/index.tsx @@ -32,6 +32,7 @@ import type { AllWorkspace } from '../../shared'; import { CollectionsList } from '../pure/workspace-slider-bar/collections'; import FavoriteList from '../pure/workspace-slider-bar/favorite/favorite-list'; import { WorkspaceSelector } from '../pure/workspace-slider-bar/WorkspaceSelector'; +import ImportPage from './import-page'; export type RootAppSidebarProps = { isPublicWorkspace: boolean; @@ -241,6 +242,9 @@ export const RootAppSidebar = ({ > {t['Trash']()} + {blockSuiteWorkspace && ( + + )} {isDesktop && }