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(layout/inline-title): hide note type switcher when empty
Elian Doran470f6e533446
diff --git a/apps/client/src/widgets/layout/InlineTitle.css b/apps/client/src/widgets/layout/InlineTitle.cssindex 2373984497..bdaa1bba15 100644--- a/apps/client/src/widgets/layout/InlineTitle.css+++ b/apps/client/src/widgets/layout/InlineTitle.css@@ -47,6 +47,7 @@ body.prefers-centered-content .inline-title {overflow-x: auto;min-width: 0;gap: 5px;+ min-height: 60px;--badge-radius: 12px;.ext-badge {diff --git a/apps/client/src/widgets/layout/InlineTitle.tsx b/apps/client/src/widgets/layout/InlineTitle.tsxindex 62bdeab907..28ea8dfc20 100644--- a/apps/client/src/widgets/layout/InlineTitle.tsx+++ b/apps/client/src/widgets/layout/InlineTitle.tsx@@ -14,7 +14,7 @@ import { formatDateTime } from "../../utils/formatters";import NoteIcon from "../note_icon";import NoteTitleWidget from "../note_title";import { Badge } from "../react/Badge";-import { useNoteContext, useNoteProperty, useStaticTooltip } from "../react/hooks";+import { useNoteBlob, useNoteContext, useNoteProperty, useStaticTooltip } from "../react/hooks";import { joinElements } from "../react/react_utils";import { useNoteMetadata } from "../ribbon/NoteInfoTab";import { onWheelHorizontalScroll } from "../widget_utils";@@ -132,6 +132,7 @@ function TextWithValue({ i18nKey, value, valueTooltip }: {//#region Note type switcherfunction NoteTypeSwitcher() {const { note } = useNoteContext();+ const blob = useNoteBlob(note);const currentNoteType = useNoteProperty(note, "type");const noteTypes = useMemo(() => NOTE_TYPES.filter((nt) => !nt.reserved && !nt.static), []);@@ -140,7 +141,7 @@ function NoteTypeSwitcher() {className="note-type-switcher"onWheel={onWheelHorizontalScroll}>- {noteTypes.map(noteType => noteType.type !== currentNoteType && (+ {blob?.contentLength === 0 && noteTypes.map(noteType => noteType.type !== currentNoteType && (<Badgekey={noteType.type}text={noteType.title}