From 72d28867aabe5273d032ee2316a02f297ed89911 Mon Sep 17 00:00:00 2001 From: alt0 Date: Tue, 7 Feb 2023 18:29:09 +0800 Subject: [PATCH 1/3] fix: workspace type wrong --- .../workspace-modal/WorkspaceCard.tsx | 49 ++++++++++++------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx index fd6a12f7f8..7c062d357f 100644 --- a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx +++ b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx @@ -12,6 +12,33 @@ import { StyleWorkspaceInfo, StyleWorkspaceTitle, StyledCard } from './styles'; import { useTranslation } from '@affine/i18n'; import { FlexWrapper } from '@/ui/layout'; +const WorkspaceType = ({ workspaceData }: { workspaceData: WorkspaceUnit }) => { + const { user } = useAppState(); + const { t } = useTranslation(); + const isOwner = user?.id === workspaceData.owner?.id; + + if (workspaceData.provider === 'local') { + return ( +

+ + {t('Local Workspace')} +

+ ); + } + + return isOwner ? ( +

+ + {t('Cloud Workspace')} +

+ ) : ( +

+ + {t('Joined Workspace')} +

+ ); +}; + export const WorkspaceCard = ({ workspaceData, onClick, @@ -19,8 +46,9 @@ export const WorkspaceCard = ({ workspaceData: WorkspaceUnit; onClick: (data: WorkspaceUnit) => void; }) => { - const { currentWorkspace, isOwner } = useAppState(); + const { currentWorkspace, user } = useAppState(); const { t } = useTranslation(); + const isOwner = user?.id === workspaceData.owner?.id; return ( {workspaceData.name || 'AFFiNE'} - {isOwner ? ( - workspaceData.provider === 'local' ? ( -

- - {t('Local Workspace')} -

- ) : ( -

- - {t('Cloud Workspace')} -

- ) - ) : ( -

- - {t('Joined Workspace')} -

- )} + {workspaceData.provider === 'local' && (

From 38b4ab41a526a70c69a087fa7dfed23b38b5bb76 Mon Sep 17 00:00:00 2001 From: alt0 Date: Tue, 7 Feb 2023 18:40:09 +0800 Subject: [PATCH 2/3] fix: remove unused variables --- packages/app/src/components/workspace-modal/WorkspaceCard.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx index 7c062d357f..2a556a1a91 100644 --- a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx +++ b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx @@ -48,7 +48,6 @@ export const WorkspaceCard = ({ }) => { const { currentWorkspace, user } = useAppState(); const { t } = useTranslation(); - const isOwner = user?.id === workspaceData.owner?.id; return ( Date: Tue, 7 Feb 2023 18:42:28 +0800 Subject: [PATCH 3/3] fix: remove unused variables --- packages/app/src/components/workspace-modal/WorkspaceCard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx index 2a556a1a91..e075bddf0d 100644 --- a/packages/app/src/components/workspace-modal/WorkspaceCard.tsx +++ b/packages/app/src/components/workspace-modal/WorkspaceCard.tsx @@ -46,7 +46,7 @@ export const WorkspaceCard = ({ workspaceData: WorkspaceUnit; onClick: (data: WorkspaceUnit) => void; }) => { - const { currentWorkspace, user } = useAppState(); + const { currentWorkspace } = useAppState(); const { t } = useTranslation(); return (