Merge branch 'feat/datacenter' of github.com:toeverything/AFFiNE into feat/datacenter

This commit is contained in:
QiShaoXuan committed 2023-01-10 15:43:41 +08:00
commit c474775982
5 files changed
+16 -19

No files matched your search

@@ -13,7 +13,6 @@ export const WorkspaceAvatar = (props: IWorkspaceAvatar) => {
const sizeStr = size + 'px'; const sizeStr = size + 'px';
const { dataCenter, currentWorkspace } = useAppState(); const { dataCenter, currentWorkspace } = useAppState();
dataCenter.getBlob(currentWorkspace, props.avatar).then(res => { dataCenter.getBlob(currentWorkspace, props.avatar).then(res => {
console.log(res);
setAvatar(res ?? ''); setAvatar(res ?? '');
}); });
const [avatar, setAvatar] = useState<string>(props.avatar); const [avatar, setAvatar] = useState<string>(props.avatar);
@@ -10,6 +10,7 @@ import {
StyledMemberRoleContainer, StyledMemberRoleContainer,
StyledMemberTitleContainer, StyledMemberTitleContainer,
StyledMoreVerticalButton, StyledMoreVerticalButton,
StyledPublishExplanation,
} from './style'; } from './style';
import { MoreVerticalIcon, EmailIcon, TrashIcon } from '@blocksuite/icons'; import { MoreVerticalIcon, EmailIcon, TrashIcon } from '@blocksuite/icons';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
@@ -173,10 +174,8 @@ export const MembersPage = ({ workspace }: { workspace: WorkspaceInfo }) => {
</> </>
) : ( ) : (
<StyledMemberWarp> <StyledMemberWarp>
<div style={{ flex: 1 }}> <>Collaborating with other members requires AFFiNE Cloud service.</>
Collaborating with other members requires AFFiNE Cloud service. <StyledPublishExplanation>
</div>
<div style={{ height: '40px' }}>
<Button <Button
type="primary" type="primary"
shape="circle" shape="circle"
@@ -200,7 +199,7 @@ export const MembersPage = ({ workspace }: { workspace: WorkspaceInfo }) => {
> >
Enable AFFiNE Cloud Enable AFFiNE Cloud
</Button> </Button>
</div> </StyledPublishExplanation>
</StyledMemberWarp> </StyledMemberWarp>
)} )}
</div> </div>
@@ -6,29 +6,27 @@ import {
import { DownloadIcon } from '@blocksuite/icons'; import { DownloadIcon } from '@blocksuite/icons';
import { Button } from '@/ui/button'; import { Button } from '@/ui/button';
import { Menu, MenuItem } from '@/ui/menu'; import { Menu, MenuItem } from '@/ui/menu';
import { useTemporaryHelper } from '@/providers/temporary-helper-provider';
import { WorkspaceInfo } from '@affine/datacenter'; import { WorkspaceInfo } from '@affine/datacenter';
export const SyncPage = ({ workspace }: { workspace: WorkspaceInfo }) => { export const SyncPage = ({ workspace }: { workspace: WorkspaceInfo }) => {
console.log('workspace: ', workspace); console.log('workspace: ', workspace);
const { currentWorkspace, updateWorkspaceMeta } = useTemporaryHelper();
return ( return (
<div> <div>
<StyledPublishContent> <StyledPublishContent>
{currentWorkspace?.type === 'local' ? ( {workspace?.provider === 'local' ? (
<> <>
<StyledPublishExplanation> <StyledPublishExplanation>
{currentWorkspace.name} is Local Workspace. All data is stored on {workspace.name ?? 'Affine'} is Local Workspace. All data is
the current device. You can enable AFFiNE Cloud for this workspace stored on the current device. You can enable AFFiNE Cloud for this
to keep data in sync with the cloud. workspace to keep data in sync with the cloud.
</StyledPublishExplanation> </StyledPublishExplanation>
<StyledPublishCopyContainer> <StyledPublishCopyContainer>
<Button <Button
onClick={() => { onClick={() => {
updateWorkspaceMeta(currentWorkspace.id, { // updateWorkspaceMeta(currentWorkspace.id, {
type: 'cloud', // type: 'cloud',
}); // });
}} }}
type="primary" type="primary"
shape="circle" shape="circle"
@@ -40,8 +38,8 @@ export const SyncPage = ({ workspace }: { workspace: WorkspaceInfo }) => {
) : ( ) : (
<> <>
<StyledPublishExplanation> <StyledPublishExplanation>
<code>{currentWorkspace && currentWorkspace.name}</code> is Cloud <code>{workspace.name ?? 'Affine'}</code> is Cloud Workspace. All
Workspace. All data will be synchronized and saved to the AFFiNE data will be synchronized and saved to the AFFiNE
</StyledPublishExplanation> </StyledPublishExplanation>
<StyledPublishCopyContainer> <StyledPublishCopyContainer>
<Menu <Menu
@@ -30,8 +30,7 @@ export const StyledSettingAvatar = styled(MuiAvatar)(() => {
export const StyledMemberWarp = styled('div')(() => { export const StyledMemberWarp = styled('div')(() => {
return { return {
display: 'flex', display: 'flex',
height: '500px',
flexDirection: 'column', flexDirection: 'column',
padding: '60px 0', padding: '40px 0',
}; };
}); });
@@ -7,6 +7,8 @@ export const StyledSettingContainer = styled('div')(({ theme }) => {
display: 'flex', display: 'flex',
padding: '50px', padding: '50px',
flexDirection: 'column', flexDirection: 'column',
height: '100vh',
overflow: 'auto',
}; };
}); });