mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 18:21:50 +03:00
chore: add import to sidebar (#2981)
This commit is contained in:
parent
7f0a74c694
commit
18874d0d1e
22
apps/web/src/components/root-app-sidebar/import-page.tsx
Normal file
22
apps/web/src/components/root-app-sidebar/import-page.tsx
Normal 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;
|
@ -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 = ({
|
||||
>
|
||||
<span data-testid="trash-page">{t['Trash']()}</span>
|
||||
</RouteMenuLinkItem>
|
||||
{blockSuiteWorkspace && (
|
||||
<ImportPage blocksuiteWorkspace={blockSuiteWorkspace} />
|
||||
)}
|
||||
</SidebarScrollableContainer>
|
||||
<SidebarContainer>
|
||||
{isDesktop && <AppUpdaterButton />}
|
||||
|
Loading…
Reference in New Issue
Block a user