chore: improve disable legacy cloud (#2041)
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
import { IconButton, Modal, ModalWrapper } from '@affine/component';
|
||||||
|
import { CloseIcon } from '@blocksuite/icons';
|
||||||
|
import type React from 'react';
|
||||||
|
|
||||||
|
import { Content, ContentTitle, Header, StyleButton, StyleTips } from './style';
|
||||||
|
|
||||||
|
interface TmpDisableAffineCloudModalProps {
|
||||||
|
open: boolean;
|
||||||
|
onClose: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const TmpDisableAffineCloudModal: React.FC<
|
||||||
|
TmpDisableAffineCloudModalProps
|
||||||
|
> = ({ open, onClose }) => {
|
||||||
|
return (
|
||||||
|
<Modal open={open} onClose={onClose}>
|
||||||
|
<ModalWrapper width={560} height={292}>
|
||||||
|
<Header>
|
||||||
|
<IconButton
|
||||||
|
onClick={() => {
|
||||||
|
onClose();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
|
</Header>
|
||||||
|
<Content>
|
||||||
|
<ContentTitle>AFFiNE Cloud is upgrading now.</ContentTitle>
|
||||||
|
<StyleTips>
|
||||||
|
We are upgrading the AFFiNE Cloud service and it is temporarily
|
||||||
|
unavailable on the client side. If you wish to be notified the first
|
||||||
|
time it's available, please <a href="#">click here</a>
|
||||||
|
</StyleTips>
|
||||||
|
<div>
|
||||||
|
<StyleButton
|
||||||
|
shape="round"
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
onClose();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Got it
|
||||||
|
</StyleButton>
|
||||||
|
</div>
|
||||||
|
</Content>
|
||||||
|
</ModalWrapper>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { Button, styled } from '@affine/component';
|
||||||
|
|
||||||
|
export const Header = styled('div')({
|
||||||
|
height: '44px',
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'row-reverse',
|
||||||
|
paddingRight: '10px',
|
||||||
|
paddingTop: '10px',
|
||||||
|
flexShrink: 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const Content = styled('div')({
|
||||||
|
textAlign: 'center',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const ContentTitle = styled('h1')({
|
||||||
|
fontSize: '20px',
|
||||||
|
lineHeight: '28px',
|
||||||
|
fontWeight: 600,
|
||||||
|
textAlign: 'center',
|
||||||
|
});
|
||||||
|
|
||||||
|
export const StyleTips = styled('div')(() => {
|
||||||
|
return {
|
||||||
|
userSelect: 'none',
|
||||||
|
width: '400px',
|
||||||
|
margin: 'auto',
|
||||||
|
marginBottom: '32px',
|
||||||
|
marginTop: '12px',
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
export const StyleButton = styled(Button)(() => {
|
||||||
|
return {
|
||||||
|
width: '284px',
|
||||||
|
display: 'block',
|
||||||
|
margin: 'auto',
|
||||||
|
marginTop: '16px',
|
||||||
|
};
|
||||||
|
});
|
||||||
@@ -15,6 +15,7 @@ import { useCallback, useState } from 'react';
|
|||||||
import { useMembers } from '../../../../../hooks/affine/use-members';
|
import { useMembers } from '../../../../../hooks/affine/use-members';
|
||||||
import { toast } from '../../../../../utils';
|
import { toast } from '../../../../../utils';
|
||||||
import { Unreachable } from '../../../affine-error-eoundary';
|
import { Unreachable } from '../../../affine-error-eoundary';
|
||||||
|
import { TmpDisableAffineCloudModal } from '../../../tmp-disable-affine-cloud-modal';
|
||||||
import { TransformWorkspaceToAffineModal } from '../../../transform-workspace-to-affine-modal';
|
import { TransformWorkspaceToAffineModal } from '../../../transform-workspace-to-affine-modal';
|
||||||
import type { PanelProps } from '../../index';
|
import type { PanelProps } from '../../index';
|
||||||
import { InviteMemberModal } from './invite-member-modal';
|
import { InviteMemberModal } from './invite-member-modal';
|
||||||
@@ -172,32 +173,40 @@ const LocalCollaborationPanel: React.FC<
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Wrapper marginBottom="42px">{t('Collaboration Description')}</Wrapper>
|
<Wrapper marginBottom="42px">{t('Collaboration Description')}</Wrapper>
|
||||||
{config.enableLegacyCloud && (
|
|
||||||
<Button
|
<Button
|
||||||
data-testid="local-workspace-enable-cloud-button"
|
data-testid="local-workspace-enable-cloud-button"
|
||||||
type="light"
|
type="light"
|
||||||
shape="circle"
|
shape="circle"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setOpen(true);
|
setOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('Enable AFFiNE Cloud')}
|
||||||
|
</Button>
|
||||||
|
{config.enableLegacyCloud ? (
|
||||||
|
<TransformWorkspaceToAffineModal
|
||||||
|
open={open}
|
||||||
|
onClose={() => {
|
||||||
|
setOpen(false);
|
||||||
}}
|
}}
|
||||||
>
|
onConform={() => {
|
||||||
{t('Enable AFFiNE Cloud')}
|
onTransferWorkspace(
|
||||||
</Button>
|
WorkspaceFlavour.LOCAL,
|
||||||
|
WorkspaceFlavour.AFFINE,
|
||||||
|
workspace
|
||||||
|
);
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<TmpDisableAffineCloudModal
|
||||||
|
open={open}
|
||||||
|
onClose={() => {
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
<TransformWorkspaceToAffineModal
|
|
||||||
open={open}
|
|
||||||
onClose={() => {
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
onConform={() => {
|
|
||||||
onTransferWorkspace(
|
|
||||||
WorkspaceFlavour.LOCAL,
|
|
||||||
WorkspaceFlavour.AFFINE,
|
|
||||||
workspace
|
|
||||||
);
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import type { AffineOfficialWorkspace } from '../../../../../shared';
|
|||||||
import { toast } from '../../../../../utils';
|
import { toast } from '../../../../../utils';
|
||||||
import { Unreachable } from '../../../affine-error-eoundary';
|
import { Unreachable } from '../../../affine-error-eoundary';
|
||||||
import { EnableAffineCloudModal } from '../../../enable-affine-cloud-modal';
|
import { EnableAffineCloudModal } from '../../../enable-affine-cloud-modal';
|
||||||
|
import { TmpDisableAffineCloudModal } from '../../../tmp-disable-affine-cloud-modal';
|
||||||
import type { WorkspaceSettingDetailProps } from '../../index';
|
import type { WorkspaceSettingDetailProps } from '../../index';
|
||||||
|
|
||||||
export type PublishPanelProps = WorkspaceSettingDetailProps & {
|
export type PublishPanelProps = WorkspaceSettingDetailProps & {
|
||||||
@@ -121,32 +122,41 @@ const PublishPanelLocal: React.FC<PublishPanelLocalProps> = ({
|
|||||||
>
|
>
|
||||||
{t('Publishing')}
|
{t('Publishing')}
|
||||||
</Box>
|
</Box>
|
||||||
{config.enableLegacyCloud && (
|
{/* TmpDisableAffineCloudModal */}
|
||||||
<Button
|
|
||||||
data-testid="publish-enable-affine-cloud-button"
|
<Button
|
||||||
type="light"
|
data-testid="publish-enable-affine-cloud-button"
|
||||||
shape="circle"
|
type="light"
|
||||||
onClick={() => {
|
shape="circle"
|
||||||
setOpen(true);
|
onClick={() => {
|
||||||
|
setOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t('Enable AFFiNE Cloud')}
|
||||||
|
</Button>
|
||||||
|
{config.enableLegacyCloud ? (
|
||||||
|
<EnableAffineCloudModal
|
||||||
|
open={open}
|
||||||
|
onClose={() => {
|
||||||
|
setOpen(false);
|
||||||
}}
|
}}
|
||||||
>
|
onConfirm={() => {
|
||||||
{t('Enable AFFiNE Cloud')}
|
onTransferWorkspace(
|
||||||
</Button>
|
WorkspaceFlavour.LOCAL,
|
||||||
|
WorkspaceFlavour.AFFINE,
|
||||||
|
workspace
|
||||||
|
);
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<TmpDisableAffineCloudModal
|
||||||
|
open={open}
|
||||||
|
onClose={() => {
|
||||||
|
setOpen(false);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
<EnableAffineCloudModal
|
|
||||||
open={open}
|
|
||||||
onClose={() => {
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
onConfirm={() => {
|
|
||||||
onTransferWorkspace(
|
|
||||||
WorkspaceFlavour.LOCAL,
|
|
||||||
WorkspaceFlavour.AFFINE,
|
|
||||||
workspace
|
|
||||||
);
|
|
||||||
setOpen(false);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { config } from '@affine/env';
|
||||||
import { useTranslation } from '@affine/i18n';
|
import { useTranslation } from '@affine/i18n';
|
||||||
import { WorkspaceFlavour } from '@affine/workspace/type';
|
import { WorkspaceFlavour } from '@affine/workspace/type';
|
||||||
import {
|
import {
|
||||||
@@ -204,37 +205,38 @@ export const WorkSpaceSliderBar: React.FC<WorkSpaceSliderBarProps> = ({
|
|||||||
)}
|
)}
|
||||||
</StyledScrollWrapper>
|
</StyledScrollWrapper>
|
||||||
<div style={{ height: 16 }}></div>
|
<div style={{ height: 16 }}></div>
|
||||||
{currentWorkspace?.flavour === WorkspaceFlavour.AFFINE &&
|
{config.enableLegacyCloud &&
|
||||||
currentWorkspace.public ? (
|
(currentWorkspace?.flavour === WorkspaceFlavour.AFFINE &&
|
||||||
<StyledListItem>
|
currentWorkspace.public ? (
|
||||||
<StyledLink
|
<StyledListItem>
|
||||||
href={{
|
<StyledLink
|
||||||
pathname:
|
href={{
|
||||||
currentWorkspaceId && paths.setting(currentWorkspaceId),
|
pathname:
|
||||||
}}
|
currentWorkspaceId && paths.setting(currentWorkspaceId),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ShareIcon />
|
||||||
|
<span data-testid="Published-to-web">Published to web</span>
|
||||||
|
</StyledLink>
|
||||||
|
</StyledListItem>
|
||||||
|
) : (
|
||||||
|
<StyledListItem
|
||||||
|
active={
|
||||||
|
currentPath ===
|
||||||
|
(currentWorkspaceId && paths.shared(currentWorkspaceId))
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<ShareIcon />
|
<StyledLink
|
||||||
<span data-testid="Published-to-web">Published to web</span>
|
href={{
|
||||||
</StyledLink>
|
pathname:
|
||||||
</StyledListItem>
|
currentWorkspaceId && paths.shared(currentWorkspaceId),
|
||||||
) : (
|
}}
|
||||||
<StyledListItem
|
>
|
||||||
active={
|
<ShareIcon />
|
||||||
currentPath ===
|
<span data-testid="shared-pages">{t('Shared Pages')}</span>
|
||||||
(currentWorkspaceId && paths.shared(currentWorkspaceId))
|
</StyledLink>
|
||||||
}
|
</StyledListItem>
|
||||||
>
|
))}
|
||||||
<StyledLink
|
|
||||||
href={{
|
|
||||||
pathname:
|
|
||||||
currentWorkspaceId && paths.shared(currentWorkspaceId),
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<ShareIcon />
|
|
||||||
<span data-testid="shared-pages">{t('Shared Pages')}</span>
|
|
||||||
</StyledLink>
|
|
||||||
</StyledListItem>
|
|
||||||
)}
|
|
||||||
<StyledListItem
|
<StyledListItem
|
||||||
active={
|
active={
|
||||||
currentPath ===
|
currentPath ===
|
||||||
|
|||||||
Reference in New Issue
Block a user