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
feat(branch_prefix): preview prefix change
Elian Dorand2c5ac2e54db
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex 3492b5bb85..b4640b2b8c 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -63,11 +63,12 @@"edit_branch_prefix": "Edit branch prefix","edit_branch_prefix_multiple": "Edit branch prefix for {{count}} branches","help_on_tree_prefix": "Help on Tree prefix",- "prefix": "Prefix: ",+ "prefix": "Prefix","save": "Save","branch_prefix_saved": "Branch prefix has been saved.","branch_prefix_saved_multiple": "Branch prefix has been saved for {{count}} branches.",- "affected_branches": "Affected branches ({{count}}):"+ "affected_branches": "Affected branches ({{count}}):",+ "preview_in_tree": "Preview in tree"},"bulk_actions": {"bulk_actions": "Bulk actions",diff --git a/apps/client/src/widgets/dialogs/branch_prefix.tsx b/apps/client/src/widgets/dialogs/branch_prefix.tsxindex ac293513da..2f7fad9c06 100644--- a/apps/client/src/widgets/dialogs/branch_prefix.tsx+++ b/apps/client/src/widgets/dialogs/branch_prefix.tsx@@ -85,12 +85,10 @@ export default function BranchPrefixDialog() {setShown(false);}- const isSingleBranch = branches.length === 1;-return (<ModalclassName="branch-prefix-dialog"- title={isSingleBranch ? t("branch_prefix.edit_branch_prefix") : t("branch_prefix.edit_branch_prefix_multiple", { count: branches.length })}+ title={branches.length === 1 ? t("branch_prefix.edit_branch_prefix") : t("branch_prefix.edit_branch_prefix_multiple", { count: branches.length })}size="lg"onShown={() => branchInput.current?.select()}onHidden={() => setShown(false)}@@ -100,30 +98,23 @@ export default function BranchPrefixDialog() {show={shown}><FormGroup label={t("branch_prefix.prefix")} name="prefix">- <div class="input-group">- <input class="branch-prefix-input form-control" value={prefix} ref={branchInput}- onChange={(e) => setPrefix((e.target as HTMLInputElement).value)} />- {isSingleBranch && branches[0] && (- <div class="branch-prefix-note-title input-group-text"> - {branches[0].getNoteFromCache()?.title}</div>- )}- </div>+ <input class="branch-prefix-input form-control" value={prefix} ref={branchInput}+ onChange={(e) => setPrefix((e.target as HTMLInputElement).value)} /></FormGroup>- {!isSingleBranch && (- <div className="branch-prefix-notes-list">- <strong>{t("branch_prefix.affected_branches", { count: branches.length })}</strong>- <ul>- {branches.map((branch) => {- const note = branch.getNoteFromCache();- return note && (- <li key={branch.branchId}>- {branch.prefix && <span className="branch-prefix-current">{branch.prefix} - </span>}- {note.title}- </li>- );- })}- </ul>- </div>- )}+ <div className="branch-prefix-notes-list">+ <strong>{t("branch_prefix.preview_in_tree")}</strong>+ <ul>+ {branches.map((branch) => {+ const note = branch.getNoteFromCache();+ return note && (+ <li key={branch.branchId}>+ {prefix && <span className="branch-prefix-current">{prefix} - </span>}+ {note.title}+ </li>+ );+ })}+ </ul>+ </div></Modal>);}