chore: add import to sidebar (#2981)

This commit is contained in:
JimmFly 2023-07-03 18:51:28 +08:00 committed by GitHub
parent 7f0a74c694
commit 18874d0d1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View File

@ -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 (
<MenuItem icon={<ImportIcon />} onClick={importFile}>
{t['Import']()}
</MenuItem>
);
};
export default ImportPage;

View File

@ -32,6 +32,7 @@ import type { AllWorkspace } from '../../shared';
import { CollectionsList } from '../pure/workspace-slider-bar/collections'; import { CollectionsList } from '../pure/workspace-slider-bar/collections';
import FavoriteList from '../pure/workspace-slider-bar/favorite/favorite-list'; import FavoriteList from '../pure/workspace-slider-bar/favorite/favorite-list';
import { WorkspaceSelector } from '../pure/workspace-slider-bar/WorkspaceSelector'; import { WorkspaceSelector } from '../pure/workspace-slider-bar/WorkspaceSelector';
import ImportPage from './import-page';
export type RootAppSidebarProps = { export type RootAppSidebarProps = {
isPublicWorkspace: boolean; isPublicWorkspace: boolean;
@ -241,6 +242,9 @@ export const RootAppSidebar = ({
> >
<span data-testid="trash-page">{t['Trash']()}</span> <span data-testid="trash-page">{t['Trash']()}</span>
</RouteMenuLinkItem> </RouteMenuLinkItem>
{blockSuiteWorkspace && (
<ImportPage blocksuiteWorkspace={blockSuiteWorkspace} />
)}
</SidebarScrollableContainer> </SidebarScrollableContainer>
<SidebarContainer> <SidebarContainer>
{isDesktop && <AppUpdaterButton />} {isDesktop && <AppUpdaterButton />}