diff --git a/apps/web/src/components/affine/workspace-setting-detail/panel/general/delete/index.tsx b/apps/web/src/components/affine/workspace-setting-detail/panel/general/delete/index.tsx index 5399028eb2..d590d21c6d 100644 --- a/apps/web/src/components/affine/workspace-setting-detail/panel/general/delete/index.tsx +++ b/apps/web/src/components/affine/workspace-setting-detail/panel/general/delete/index.tsx @@ -2,6 +2,7 @@ import { Button, Input, Modal, ModalCloseButton } from '@affine/component'; import { Trans, useTranslation } from '@affine/i18n'; import { useCallback, useState } from 'react'; +import { useBlockSuiteWorkspaceName } from '../../../../../../hooks/use-blocksuite-workspace-name'; import { AffineOfficialWorkspace, RemWorkspaceFlavour, @@ -28,8 +29,11 @@ export const WorkspaceDeleteModal = ({ workspace, onDeleteWorkspace, }: WorkspaceDeleteProps) => { + const [workspaceName] = useBlockSuiteWorkspaceName( + workspace.blockSuiteWorkspace ?? null + ); const [deleteStr, setDeleteStr] = useState(''); - const allowDelete = deleteStr.toLowerCase() === 'delete'; + const allowDelete = deleteStr === workspaceName; const { t } = useTranslation(); const handleDelete = useCallback(() => { @@ -46,7 +50,7 @@ export const WorkspaceDeleteModal = ({ Deleting ( - {{ workspace: workspace.blockSuiteWorkspace.meta.name } as any} + {{ workspace: workspaceName } as any} ) cannot be undone, please proceed with caution. All contents will be lost. @@ -57,7 +61,7 @@ export const WorkspaceDeleteModal = ({ Deleting ( - {{ workspace: workspace.blockSuiteWorkspace.meta.name } as any} + {{ workspace: workspaceName } as any} ) will delete both local and cloud data, this operation cannot be undone, please proceed with caution. @@ -68,11 +72,11 @@ export const WorkspaceDeleteModal = ({ + />