From 78facb2fe6ad066f93524ac92d89c1b658a21e23 Mon Sep 17 00:00:00 2001 From: DiamondThree Date: Fri, 6 Jan 2023 16:45:34 +0800 Subject: [PATCH] fix: fix filename and tabname --- .../src/components/workspace-modal/index.tsx | 20 +++++------ .../workspace-setting/MembersPage.tsx | 33 +++++++++++++++---- .../workspace-setting/PublishPage.tsx | 24 +++++++------- .../workspace-setting/general/style.ts | 9 +++++ .../src/components/workspace-setting/style.ts | 1 + .../workspace-setting/workspace-setting.tsx | 2 +- 6 files changed, 59 insertions(+), 30 deletions(-) diff --git a/packages/app/src/components/workspace-modal/index.tsx b/packages/app/src/components/workspace-modal/index.tsx index 495feb2c1a..2c15d97218 100644 --- a/packages/app/src/components/workspace-modal/index.tsx +++ b/packages/app/src/components/workspace-modal/index.tsx @@ -31,7 +31,6 @@ export const WorkspaceModal = ({ open, onClose }: LoginModalProps) => { updateWorkspaceMeta, } = useTemporaryHelper(); - console.log('workspaceMetaList: ', workspaceMetaList); return (
@@ -164,16 +163,15 @@ export const WorkspaceModal = ({ open, onClose }: LoginModalProps) => { confirmText: user ? 'Enable' : 'Sign in and Enable', cancelText: 'Skip', }).then(confirm => { - if (user) { - console.log('enable cloud'); - workspaceId && - setTimeout(() => { - updateWorkspaceMeta(workspaceId as string, { - type: 'cloud', - }); - }, 1000); - } else { - confirm && login(); + if (confirm) { + if (user) { + workspaceId && + updateWorkspaceMeta(workspaceId, { isPublish: true }); + } else { + login(); + workspaceId && + updateWorkspaceMeta(workspaceId, { isPublish: true }); + } } }); }} diff --git a/packages/app/src/components/workspace-setting/MembersPage.tsx b/packages/app/src/components/workspace-setting/MembersPage.tsx index 20903dbca4..83407b6342 100644 --- a/packages/app/src/components/workspace-setting/MembersPage.tsx +++ b/packages/app/src/components/workspace-setting/MembersPage.tsx @@ -24,12 +24,15 @@ import { Workspace, } from '@/hooks/mock-data/mock'; import { useTemporaryHelper } from '@/providers/temporary-helper-provider'; +import { StyledMemberWarp } from './general/style'; +import { useConfirm } from '@/providers/confirm-provider'; // import { useAppState } from '@/providers/app-state-provider'; export const MembersPage = ({ workspace }: { workspace: Workspace }) => { const [isInviteModalShow, setIsInviteModalShow] = useState(false); const [members, setMembers] = useState([]); - const { user, login } = useTemporaryHelper(); + const { user, login, updateWorkspaceMeta } = useTemporaryHelper(); + const { confirm } = useConfirm(); // const refreshMembers = useCallback(() => { // getDataCenter() // .then(dc => @@ -57,7 +60,7 @@ export const MembersPage = ({ workspace }: { workspace: Workspace }) => { return (
- {user ? ( + {workspace.type === 'cloud' ? ( <> @@ -169,20 +172,36 @@ export const MembersPage = ({ workspace }: { workspace: Workspace }) => { ) : ( - <> -
+ +
Collaborating with other members requires AFFiNE Cloud service.
-
+
- + )}
); diff --git a/packages/app/src/components/workspace-setting/PublishPage.tsx b/packages/app/src/components/workspace-setting/PublishPage.tsx index 0e8a9b5cf3..f09cb3e11c 100644 --- a/packages/app/src/components/workspace-setting/PublishPage.tsx +++ b/packages/app/src/components/workspace-setting/PublishPage.tsx @@ -14,15 +14,15 @@ import { useTemporaryHelper } from '@/providers/temporary-helper-provider'; import { useConfirm } from '@/providers/confirm-provider'; export const PublishPage = ({ workspace }: { workspace: Workspace }) => { + console.log('workspace: ', workspace); const shareUrl = window.location.host + '/workspace/' + workspace.id + '?share=true'; - const { login, updateWorkspaceMeta, user, currentWorkspace } = - useTemporaryHelper(); + const { login, updateWorkspaceMeta, user } = useTemporaryHelper(); const { confirm } = useConfirm(); const togglePublic = (flag: boolean) => { - updateWorkspaceMeta(currentWorkspace.id, { isPublish: flag }); + updateWorkspaceMeta(workspace.id, { isPublish: flag }); }; const copyUrl = () => { @@ -37,20 +37,22 @@ export const PublishPage = ({ workspace }: { workspace: Workspace }) => { confirmText: user ? 'Enable' : 'Sign in and Enable', cancelText: 'Skip', }).then(confirm => { - if (user) { - updateWorkspaceMeta(currentWorkspace.id, { isPublish: true }); - } else { - confirm && login(); - updateWorkspaceMeta(currentWorkspace.id, { isPublish: true }); + if (confirm) { + if (user) { + updateWorkspaceMeta(workspace.id, { isPublish: true }); + } else { + login(); + updateWorkspaceMeta(workspace.id, { isPublish: true }); + } } }); }; return ( <> - {currentWorkspace.type === 'cloud' ? ( + {workspace.type === 'cloud' ? (
- {currentWorkspace?.isPublish ? ( + {workspace?.isPublish ? ( <> Publishing to web requires AFFiNE Cloud service . @@ -74,7 +76,7 @@ export const PublishPage = ({ workspace }: { workspace: Workspace }) => { )} - {!currentWorkspace?.isPublish ? ( + {!workspace.isPublish ? (