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
fix(layout/inline-title): current note type displayed in switcher
Elian Dorane06abe6e5b4d
diff --git a/apps/client/src/widgets/layout/InlineTitle.tsx b/apps/client/src/widgets/layout/InlineTitle.tsxindex 06959a6e34..2fa8027086 100644--- a/apps/client/src/widgets/layout/InlineTitle.tsx+++ b/apps/client/src/widgets/layout/InlineTitle.tsx@@ -11,7 +11,7 @@ import { ViewScope } from "../../services/link";import { formatDateTime } from "../../utils/formatters";import NoteIcon from "../note_icon";import NoteTitleWidget from "../note_title";-import { useNoteContext, useStaticTooltip } from "../react/hooks";+import { useNoteContext, useNoteProperty, useStaticTooltip } from "../react/hooks";import { joinElements } from "../react/react_utils";import { useNoteMetadata } from "../ribbon/NoteInfoTab";import { NOTE_TYPES } from "../../services/note_types";@@ -131,11 +131,12 @@ function TextWithValue({ i18nKey, value, valueTooltip }: {//#region Note type switcherfunction NoteTypeSwitcher() {const { note } = useNoteContext();+ const currentNoteType = useNoteProperty(note, "type");const noteTypes = useMemo(() => NOTE_TYPES.filter((nt) => !nt.reserved && !nt.static), []);return (note &&<div className="note-type-switcher">- {noteTypes.map(noteType => (+ {noteTypes.map(noteType => noteType.type !== currentNoteType && (<Badgekey={noteType.type}text={noteType.title}