From 52114e08ba30eb5a416a0d6afb8ad252f2e3b07d Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 11 Apr 2026 12:44:28 +0300 Subject: [PATCH] chore(delete): remove redundant list of clones --- .../src/translations/en/translation.json | 4 +- .../src/widgets/dialogs/delete_notes.css | 20 ------- .../src/widgets/dialogs/delete_notes.tsx | 57 +++++-------------- 3 files changed, 16 insertions(+), 65 deletions(-) diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 806134b62b..7987a79ec1 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -102,9 +102,7 @@ "cancel": "Cancel", "ok": "OK", "deleted_relation_text": "Note {{- note}} (to be deleted) is referenced by relation {{- relation}} originating from {{- source}}.", - "no_clones_message": "The selected notes have no clones.", - "delete_clones_with_count": "Also delete {{count}} other clone(s) (can be undone in recent changes)", - "and_more_clones": "and {{count}} more..." + "no_clones_message": "The selected notes have no clones." }, "export": { "export_note_title": "Export note", diff --git a/apps/client/src/widgets/dialogs/delete_notes.css b/apps/client/src/widgets/dialogs/delete_notes.css index 651c97a21f..9a648cc474 100644 --- a/apps/client/src/widgets/dialogs/delete_notes.css +++ b/apps/client/src/widgets/dialogs/delete_notes.css @@ -6,19 +6,6 @@ margin-bottom: 0; } -.delete-notes-dialog .clone-paths-list { - margin: 8px 0 0 24px; - padding: 0; - font-size: 0.9em; - color: var(--muted-text-color); - max-height: 150px; - overflow: auto; -} - -.delete-notes-dialog .clone-paths-list li { - margin-bottom: 4px; -} - .delete-notes-dialog .preview-list { margin: 0; padding-left: 20px; @@ -29,10 +16,3 @@ .delete-notes-dialog .preview-list li { margin-bottom: 4px; } - -/* Alert inside card section should be borderless */ -.delete-notes-dialog .tn-card-section:has(.alert) { - padding: 0; - border: none; - background: transparent; -} diff --git a/apps/client/src/widgets/dialogs/delete_notes.tsx b/apps/client/src/widgets/dialogs/delete_notes.tsx index ad75bee4d9..edc0abd01e 100644 --- a/apps/client/src/widgets/dialogs/delete_notes.tsx +++ b/apps/client/src/widgets/dialogs/delete_notes.tsx @@ -16,7 +16,6 @@ import OptionsRow from "../type_widgets/options/components/OptionsRow.js"; interface CloneInfo { totalCloneCount: number; - clonePaths: string[]; } export interface ResolveOptions { @@ -44,7 +43,7 @@ export default function DeleteNotesDialog() { const [ brokenRelations, setBrokenRelations ] = useState([]); const [ noteIdsToBeDeleted, setNoteIdsToBeDeleted ] = useState([]); const [ shown, setShown ] = useState(false); - const [ cloneInfo, setCloneInfo ] = useState({ totalCloneCount: 0, clonePaths: [] }); + const [ cloneInfo, setCloneInfo ] = useState({ totalCloneCount: 0 }); const okButtonRef = useRef(null); useTriliumEvent("showDeleteNotesDialog", (opts) => { @@ -56,7 +55,7 @@ export default function DeleteNotesDialog() { useEffect(() => { const { branchIdsToDelete } = opts; if (!branchIdsToDelete || branchIdsToDelete.length === 0) { - setCloneInfo({ totalCloneCount: 0, clonePaths: [] }); + setCloneInfo({ totalCloneCount: 0 }); return; } @@ -66,29 +65,15 @@ export default function DeleteNotesDialog() { const notes = await froca.getNotes(uniqueNoteIds); let totalCloneCount = 0; - const clonePaths: string[] = []; for (const note of notes) { const parentBranches = note.getParentBranches(); // Clones are additional parent branches beyond the one being deleted const otherBranches = parentBranches.filter(b => !branchIdsToDelete!.includes(b.branchId)); - - if (otherBranches.length > 0) { - totalCloneCount += otherBranches.length; - - // Get paths for preview (limit to first 5 total) - for (const branch of otherBranches) { - if (clonePaths.length >= 5) break; - const pathHtml = (await link.createLink(note.noteId, { - showNotePath: true, - referenceLink: false - })).html(); - clonePaths.push(pathHtml); - } - } + totalCloneCount += otherBranches.length; } - setCloneInfo({ totalCloneCount, clonePaths }); + setCloneInfo({ totalCloneCount }); } calculateCloneInfo(); @@ -168,7 +153,7 @@ interface DeleteAllClonesOptionProps { } function DeleteAllClonesOption({ cloneInfo, deleteAllClones, setDeleteAllClones }: DeleteAllClonesOptionProps) { - const { totalCloneCount, clonePaths } = cloneInfo; + const { totalCloneCount } = cloneInfo; if (totalCloneCount === 0) { return ( @@ -183,28 +168,16 @@ function DeleteAllClonesOption({ cloneInfo, deleteAllClones, setDeleteAllClones } return ( -
- - - - {clonePaths.length > 0 && ( -
    - {clonePaths.map((path, index) => ( -
  • - ))} - {totalCloneCount > clonePaths.length && ( -
  • {t("delete_notes.and_more_clones", { count: totalCloneCount - clonePaths.length })}
  • - )} -
- )} -
+ + + ); }