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(note_info): display user-friendly note type name & icon
Elian Doran2e563b0a1fc8
diff --git a/apps/client/src/widgets/layout/StatusBar.tsx b/apps/client/src/widgets/layout/StatusBar.tsxindex efe513957b..c80d58aea0 100644--- a/apps/client/src/widgets/layout/StatusBar.tsx+++ b/apps/client/src/widgets/layout/StatusBar.tsx@@ -13,6 +13,7 @@ import FNote from "../../entities/fnote";import attributes from "../../services/attributes";import { t } from "../../services/i18n";import { ViewScope } from "../../services/link";+import { NOTE_TYPES } from "../../services/note_types";import server from "../../services/server";import { openInAppHelpFromUrl } from "../../services/utils";import { formatDateTime } from "../../utils/formatters";@@ -219,8 +220,10 @@ export function NoteInfoBadge({ note, setSimilarNotesShown }: NoteInfoContext) {const dropdownRef = useRef<BootstrapDropdown>(null);const { metadata, ...sizeProps } = useNoteMetadata(note);const [ originalFileName ] = useNoteLabel(note, "originalFileName");+ const currentNoteType = useNoteProperty(note, "type");+ const currentNoteTypeData = useMemo(() => NOTE_TYPES.find(t => t.type === currentNoteType), [ currentNoteType ]);- return (note &&+ return (note && currentNoteTypeData &&<StatusBarDropdownicon="bx bx-info-circle"title={t("status_bar.note_info_title")}@@ -232,7 +235,7 @@ export function NoteInfoBadge({ note, setSimilarNotesShown }: NoteInfoContext) {{originalFileName && <NoteInfoValue text={t("file_properties.original_file_name")} value={originalFileName} />}<NoteInfoValue text={t("note_info_widget.created")} value={formatDateTime(metadata?.dateCreated)} /><NoteInfoValue text={t("note_info_widget.modified")} value={formatDateTime(metadata?.dateModified)} />- <NoteInfoValue text={t("note_info_widget.type")} value={note.type} />+ <NoteInfoValue text={t("note_info_widget.type")} value={<><Icon icon={`bx ${currentNoteTypeData.icon}`}/>{" "}{currentNoteTypeData?.title}</>} /><NoteInfoValue text={t("note_info_widget.mime")} value={note.mime} /><NoteInfoValue text={t("note_info_widget.note_id")} value={<code>{note.noteId}</code>} /><NoteInfoValue text={t("note_info_widget.note_size")} title={t("note_info_widget.note_size_info")} value={<NoteSizeWidget {...sizeProps} />} />