mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
fix: logic after delete all workspaces (#2587)
Co-authored-by: JimmFly <yangjinfei001@gmail.com>
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Button, toast } from '@affine/component';
|
||||
import { WorkspaceAvatar } from '@affine/component/workspace-avatar';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { rootWorkspacesMetadataAtom } from '@affine/workspace/atom';
|
||||
import {
|
||||
ArrowRightSmallIcon,
|
||||
DeleteIcon,
|
||||
@@ -12,7 +11,6 @@ import {
|
||||
import { useBlockSuiteWorkspaceAvatarUrl } from '@toeverything/hooks/use-block-suite-workspace-avatar-url';
|
||||
import { useBlockSuiteWorkspaceName } from '@toeverything/hooks/use-block-suite-workspace-name';
|
||||
import clsx from 'clsx';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import type React from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
@@ -88,7 +86,6 @@ export const GeneralPanel: React.FC<PanelProps> = ({
|
||||
workspace.blockSuiteWorkspace
|
||||
);
|
||||
|
||||
const isLastWorkspace = useAtomValue(rootWorkspacesMetadataAtom).length === 1;
|
||||
return (
|
||||
<>
|
||||
<div data-testid="avatar-row" className={style.row}>
|
||||
@@ -225,14 +222,6 @@ export const GeneralPanel: React.FC<PanelProps> = ({
|
||||
<div className={style.settingItemLabelHint}>
|
||||
{t['Delete Workspace Label Hint']()}
|
||||
</div>
|
||||
{isOwner && isLastWorkspace && (
|
||||
<div
|
||||
className={style.settingsCannotDelete}
|
||||
data-testid="warn-cannot-delete-last-workspace"
|
||||
>
|
||||
{t['com.affine.workspace.cannot-delete']()}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className={style.col}></div>
|
||||
@@ -243,7 +232,6 @@ export const GeneralPanel: React.FC<PanelProps> = ({
|
||||
type="warning"
|
||||
data-testid="delete-workspace-button"
|
||||
size="middle"
|
||||
disabled={isLastWorkspace}
|
||||
icon={<DeleteIcon />}
|
||||
onClick={() => {
|
||||
setShowDelete(true);
|
||||
|
||||
Reference in New Issue
Block a user