mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 01:56:27 +08:00
feat: enable share menu (#1883)
Co-authored-by: JimmFly <yangjinfei001@gmail.com>
This commit is contained in:
@@ -122,6 +122,7 @@ export class AffineErrorBoundary extends Component<
|
||||
return (
|
||||
<>
|
||||
<h1>Sorry.. there was an error</h1>
|
||||
{error.message ?? error.toString()}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
import { MenuItem, styled } from '@affine/component';
|
||||
import type { PublicLinkDisableProps } from '@affine/component/share-menu';
|
||||
import { PublicLinkDisableModal } from '@affine/component/share-menu';
|
||||
import { useTranslation } from '@affine/i18n';
|
||||
import { ShareIcon } from '@blocksuite/icons';
|
||||
|
||||
import type { CommonMenuItemProps } from './types';
|
||||
|
||||
const StyledMenuItem = styled(MenuItem)(({ theme }) => {
|
||||
return {
|
||||
div: {
|
||||
color: theme.palette.error.main,
|
||||
svg: {
|
||||
color: theme.palette.error.main,
|
||||
},
|
||||
},
|
||||
':hover': {
|
||||
div: {
|
||||
color: theme.palette.error.main,
|
||||
svg: {
|
||||
color: theme.palette.error.main,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
});
|
||||
export const DisablePublicSharing = ({
|
||||
onSelect,
|
||||
onItemClick,
|
||||
testId,
|
||||
}: CommonMenuItemProps) => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<>
|
||||
<StyledMenuItem
|
||||
data-testid={testId}
|
||||
onClick={() => {
|
||||
onItemClick?.();
|
||||
onSelect?.();
|
||||
}}
|
||||
style={{ color: 'red' }}
|
||||
icon={<ShareIcon />}
|
||||
>
|
||||
{t('Disable Public Sharing')}
|
||||
</StyledMenuItem>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
const DisablePublicSharingModal = ({
|
||||
page,
|
||||
open,
|
||||
onClose,
|
||||
}: PublicLinkDisableProps) => {
|
||||
return <PublicLinkDisableModal page={page} open={open} onClose={onClose} />;
|
||||
};
|
||||
|
||||
DisablePublicSharing.DisablePublicSharingModal = DisablePublicSharingModal;
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from './CopyLink';
|
||||
export * from './DisablePublicSharing';
|
||||
export * from './Export';
|
||||
export * from './MoveTo';
|
||||
export * from './MoveToTrash';
|
||||
|
||||
@@ -19,7 +19,11 @@ export const TransformWorkspaceToAffineModal: React.FC<
|
||||
const user = useCurrentUser();
|
||||
|
||||
return (
|
||||
<Modal open={open} onClose={onClose} data-testid="logout-modal">
|
||||
<Modal
|
||||
open={open}
|
||||
onClose={onClose}
|
||||
data-testid="enable-affine-cloud-modal"
|
||||
>
|
||||
<ModalWrapper width={560} height={292}>
|
||||
<Header>
|
||||
<IconButton
|
||||
|
||||
Reference in New Issue
Block a user