mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-11-30 01:00:27 +03:00
fix(core): use permanent delete icon consistently (#13051)
- Update to DeletePermanentlyIcon in QuickDeletePermanently and trash-page-footer - A trivial refactor to use permanentlyDeletePage helper method <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Style** * Updated permanent-delete buttons in quick actions and the trash page to use a dedicated permanent-delete icon. * **Bug Fixes** * After confirming permanent deletion from the trash page, the app returns to the All pages view and displays a confirmation once deletion completes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: DarkSky <darksky2048@gmail.com>
This commit is contained in:
1 parent
cba28c36b1
commit
e9b4be0897
2 files changed
+11
-8
No files matched your search
@@ -14,6 +14,7 @@ import { useI18n } from '@affine/i18n';
|
||||
import track from '@affine/track';
|
||||
import {
|
||||
DeleteIcon,
|
||||
DeletePermanentlyIcon,
|
||||
OpenInNewIcon,
|
||||
ResetIcon,
|
||||
SplitViewIcon,
|
||||
@@ -292,7 +293,7 @@ export const QuickDeletePermanently = memo(function QuickDeletePermanently({
|
||||
<IconButton
|
||||
data-testid="delete-page-button"
|
||||
onClick={handleConfirmDeletePermanently}
|
||||
icon={<DeleteIcon />}
|
||||
icon={<DeletePermanentlyIcon />}
|
||||
variant="danger"
|
||||
{...iconButtonProps}
|
||||
/>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ConfirmModal } from '@affine/component/ui/modal';
|
||||
import { DocService } from '@affine/core/modules/doc';
|
||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import { DeleteIcon, ResetIcon } from '@blocksuite/icons/rc';
|
||||
import { DeletePermanentlyIcon, ResetIcon } from '@blocksuite/icons/rc';
|
||||
import { useService } from '@toeverything/infra';
|
||||
import { useCallback, useState } from 'react';
|
||||
|
||||
@@ -15,12 +15,11 @@ import * as styles from './styles.css';
|
||||
|
||||
export const TrashPageFooter = () => {
|
||||
const workspace = useService(WorkspaceService).workspace;
|
||||
const docCollection = workspace.docCollection;
|
||||
const doc = useService(DocService).doc;
|
||||
const t = useI18n();
|
||||
const { appSettings } = useAppSettingHelper();
|
||||
const { jumpToPage } = useNavigateHelper();
|
||||
const { restoreFromTrash } = useBlockSuiteMetaHelper();
|
||||
const { restoreFromTrash, permanentlyDeletePage } = useBlockSuiteMetaHelper();
|
||||
const [open, setOpen] = useState(false);
|
||||
const hintText = t['com.affine.cmdk.affine.editor.trash-footer-hint']();
|
||||
|
||||
@@ -38,9 +37,12 @@ export const TrashPageFooter = () => {
|
||||
|
||||
const onConfirmDelete = useCallback(() => {
|
||||
jumpToPage(workspace.id, 'all');
|
||||
docCollection.removeDoc(doc.id);
|
||||
toast(t['com.affine.toastMessage.permanentlyDeleted']());
|
||||
}, [jumpToPage, workspace.id, docCollection, doc.id, t]);
|
||||
permanentlyDeletePage(doc.id)
|
||||
?.then(() => {
|
||||
toast(t['com.affine.toastMessage.permanentlyDeleted']());
|
||||
})
|
||||
.catch(error => console.error(error));
|
||||
}, [jumpToPage, workspace.id, doc.id, permanentlyDeletePage, t]);
|
||||
|
||||
const onDelete = useCallback(() => {
|
||||
setOpen(true);
|
||||
@@ -67,7 +69,7 @@ export const TrashPageFooter = () => {
|
||||
variant="error"
|
||||
onClick={onDelete}
|
||||
className={styles.buttonContainer}
|
||||
prefix={<DeleteIcon />}
|
||||
prefix={<DeletePermanentlyIcon />}
|
||||
prefixClassName={styles.icon}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user