mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-26 14:38:06 +03:00
Merge pull request #881 from toeverything/fix-workspace-type
fix: workspace type wrong
This commit is contained in:
commit
4d689529b9
@ -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 (
|
||||
<p>
|
||||
<LocalIcon />
|
||||
{t('Local Workspace')}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
return isOwner ? (
|
||||
<p>
|
||||
<CloudIcon />
|
||||
{t('Cloud Workspace')}
|
||||
</p>
|
||||
) : (
|
||||
<p>
|
||||
<UsersIcon fontSize={20} color={'#FF646B'} />
|
||||
{t('Joined Workspace')}
|
||||
</p>
|
||||
);
|
||||
};
|
||||
|
||||
export const WorkspaceCard = ({
|
||||
workspaceData,
|
||||
onClick,
|
||||
@ -19,7 +46,7 @@ export const WorkspaceCard = ({
|
||||
workspaceData: WorkspaceUnit;
|
||||
onClick: (data: WorkspaceUnit) => void;
|
||||
}) => {
|
||||
const { currentWorkspace, isOwner } = useAppState();
|
||||
const { currentWorkspace } = useAppState();
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<StyledCard
|
||||
@ -37,24 +64,7 @@ export const WorkspaceCard = ({
|
||||
<StyleWorkspaceTitle>
|
||||
{workspaceData.name || 'AFFiNE'}
|
||||
</StyleWorkspaceTitle>
|
||||
{isOwner ? (
|
||||
workspaceData.provider === 'local' ? (
|
||||
<p>
|
||||
<LocalIcon />
|
||||
{t('Local Workspace')}
|
||||
</p>
|
||||
) : (
|
||||
<p>
|
||||
<CloudIcon />
|
||||
{t('Cloud Workspace')}
|
||||
</p>
|
||||
)
|
||||
) : (
|
||||
<p>
|
||||
<UsersIcon fontSize={20} color={'#FF646B'} />
|
||||
{t('Joined Workspace')}
|
||||
</p>
|
||||
)}
|
||||
<WorkspaceType workspaceData={workspaceData} />
|
||||
{workspaceData.provider === 'local' && (
|
||||
<p>
|
||||
<OfflineIcon />
|
||||
|
Loading…
Reference in New Issue
Block a user