Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/deleted notes dialog: if the listing is limited to the subtree of a hoisted note, show a clue in the title
Adorian Doran82a1dfb7733e
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 72a46ff361..07c2bc61e4 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -418,6 +418,7 @@"recent_changes": {"title": "Recent changes","deleted_notes_title": "Deleted notes",+ "title_with_ancestor": "{{- title}} - {{- ancestorTitle}}","erase_notes_button": "Erase deleted notes now","more_actions": "More actions","deleted_notes_settings": "Deleted Notes Settings",diff --git a/apps/client/src/widgets/dialogs/recent_changes.tsx b/apps/client/src/widgets/dialogs/recent_changes.tsxindex bb62b28cc7..8bf2bb0b61 100644--- a/apps/client/src/widgets/dialogs/recent_changes.tsx+++ b/apps/client/src/widgets/dialogs/recent_changes.tsx@@ -23,6 +23,7 @@ export default function RecentChangesDialog() {const [ refreshCounter, setRefreshCounter ] = useState(0);const [ shown, setShown ] = useState(false);const [ deletedOnly, setDeletedOnly ] = useState(false);+ const [ ancestorTitle, setAncestorTitle ] = useState<string>();useTriliumEvent("showRecentChanges", ({ ancestorNoteId }) => {setAncestorNoteId(ancestorNoteId ?? hoisted_note.getHoistedNoteId());@@ -36,6 +37,17 @@ export default function RecentChangesDialog() {setShown(true);});+ useEffect(() => {+ // A scoped view (a hoisted note, or a subtree opened from the tree context menu) should say+ // which subtree it covers. Root is the implicit default and needs no qualifier.+ if (!ancestorNoteId || ancestorNoteId === "root") {+ setAncestorTitle(undefined);+ return;+ }++ froca.getNote(ancestorNoteId, true).then((note) => setAncestorTitle(note?.title));+ }, [ ancestorNoteId ]);+useEffect(() => {if (!ancestorNoteId) return;server.get<RecentChangeRow[]>(`recent-changes/${ancestorNoteId}?deletedOnly=${deletedOnly}`)@@ -51,9 +63,13 @@ export default function RecentChangesDialog() {});}, [ shown, refreshCounter, deletedOnly ])+ const baseTitle = deletedOnly ? t("recent_changes.deleted_notes_title") : t("recent_changes.title");+return (<Modal- title={deletedOnly ? t("recent_changes.deleted_notes_title") : t("recent_changes.title")}+ title={ancestorTitle+ ? t("recent_changes.title_with_ancestor", { title: baseTitle, ancestorTitle })+ : baseTitle}className={`recent-changes-dialog ${deletedOnly ? "recent-changes-dialog-view-mode-deleted-only" : "recent-changes-dialog-view-mode-all-changes"}`}size="lg"scrollable