Skip to content

Build your personal knowledge base with Trilium Notes

client/note types mapping: add a way to highlight newly introduced types

Adorian Dorand869056910f7
diff --git a/apps/client/src/services/note_types.ts b/apps/client/src/services/note_types.ts
index dd4137ee9a..5d52b7528b 100644
--- a/apps/client/src/services/note_types.ts
+++ b/apps/client/src/services/note_types.ts
@@ -10,6 +10,8 @@ export interface NoteTypeMapping {
mime?: string;
title: string;
icon?: string;
+ /** Indicates whether this type should be marked as a newly introduced feature. */
+ isNew?: boolean;
/** Indicates that this note type is part of a beta feature. */
isBeta?: boolean;
/** Indicates that this note type cannot be created by the user. */
@@ -77,6 +79,10 @@ function getBlankNoteTypes(command): MenuItem<TreeCommandNames>[] {
badges: []
}
+ if (nt.isNew) {
+ menuItem.badges?.push({title: t("note_types.new-feature"), className: "new-note-type-badge"});
+ }
+
if (nt.isBeta) {
menuItem.badges?.push({title: t("note_types.beta-feature")});
}
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index e3ae657b72..7663f1fc53 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -1626,7 +1626,8 @@
"geo-map": "Geo Map",
"beta-feature": "Beta",
"ai-chat": "AI Chat",
- "task-list": "Task List"
+ "task-list": "Task List",
+ "new-feature": "New"
},
"protect_note": {
"toggle-on": "Protect the note",
diff --git a/apps/client/src/widgets/note_type.ts b/apps/client/src/widgets/note_type.ts
index 04602813d3..d1a40b4085 100644
--- a/apps/client/src/widgets/note_type.ts
+++ b/apps/client/src/widgets/note_type.ts
@@ -69,6 +69,11 @@ export default class NoteTypeWidget extends NoteContextAwareWidget {
let $typeLink: JQuery<HTMLElement>;
const $title = $("<span>").text(noteType.title);
+
+ if (noteType.isNew) {
+ $title.append($(`<span class="badge new-note-type-badge">`).text(t("note_types.new-feature")));
+ }
+
if (noteType.isBeta) {
$title.append($(`<span class="badge">`).text(t("note_types.beta-feature")));
}