mirror of
https://github.com/zadam/trilium.git
synced 2025-12-16 05:09:54 +01:00
feat(layout/inline-title): hide note type switcher when empty
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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 switcher
|
||||
function 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 && (
|
||||
<Badge
|
||||
key={noteType.type}
|
||||
text={noteType.title}
|
||||
|
||||
Reference in New Issue
Block a user