import { type AffineCloudWorkspace, type AffineOfficialWorkspace, type AffinePublicWorkspace, type LocalWorkspace, WorkspaceFlavour, } from '@affine/env/workspace'; import { useAFFiNEI18N } from '@affine/i18n/hooks'; import { WebIcon } from '@blocksuite/icons'; import type { Page } from '@blocksuite/store'; import { Button } from '@toeverything/components/button'; import { Divider } from '@toeverything/components/divider'; import { Menu } from '@toeverything/components/menu'; import * as styles from './index.css'; import { ShareExport } from './share-export'; import { SharePage } from './share-page'; export interface ShareMenuProps< Workspace extends AffineOfficialWorkspace = | AffineCloudWorkspace | LocalWorkspace | AffinePublicWorkspace, > { workspace: Workspace; currentPage: Page; useIsSharedPage: ( workspaceId: string, pageId: string ) => [isSharePage: boolean, setIsSharePage: (enable: boolean) => void]; onEnableAffineCloud: () => void; togglePagePublic: () => Promise; exportHandler: (type: 'pdf' | 'html' | 'png' | 'markdown') => Promise; } const ShareMenuContent = (props: ShareMenuProps) => { const t = useAFFiNEI18N(); return (
{t['com.affine.share-menu.SharePage']()}
); }; const LocalShareMenu = (props: ShareMenuProps) => { const t = useAFFiNEI18N(); return ( } contentOptions={{ className: styles.menuStyle, ['data-testid' as string]: 'local-share-menu', }} rootOptions={{ modal: false, }} > ); }; const CloudShareMenu = (props: ShareMenuProps) => { const t = useAFFiNEI18N(); const { workspace, currentPage, useIsSharedPage } = props; const [isSharedPage] = useIsSharedPage(workspace.id, currentPage.id); return ( } contentOptions={{ className: styles.menuStyle, ['data-testid' as string]: 'cloud-share-menu', }} rootOptions={{ modal: false, }} > ); }; export const ShareMenu = (props: ShareMenuProps) => { const { workspace } = props; if (workspace.flavour === WorkspaceFlavour.LOCAL) { return ; } return ; };