client/dialogs/note type chooser: fix broken headings regression

This commit is contained in:
Adorian Doran 2025-09-21 10:31:36 +03:00
parent 089ca7fd29
commit 113af940c1

View File

@ -37,6 +37,7 @@ export default function NoteTypeChooserDialogComponent() {
}); });
useEffect(() => { useEffect(() => {
console.log(noteTypes);
note_types.getNoteTypeItems().then(noteTypes => { note_types.getNoteTypeItems().then(noteTypes => {
let index = -1; let index = -1;
@ -44,8 +45,8 @@ export default function NoteTypeChooserDialogComponent() {
if ("kind" in item && item.kind === "separator") { if ("kind" in item && item.kind === "separator") {
index++; index++;
return { return {
title: SEPARATOR_TITLE_REPLACEMENTS[index], kind: "header",
enabled: false title: SEPARATOR_TITLE_REPLACEMENTS[index]
} }
} }
@ -101,15 +102,15 @@ export default function NoteTypeChooserDialogComponent() {
const item = _item as MenuCommandItem<TreeCommandNames>; const item = _item as MenuCommandItem<TreeCommandNames>;
if (item.enabled === false) { if ("kind" in item && item.kind === "header") {
return <FormListHeader text={item.title} /> return <FormListHeader text={item.title} />
} else { } else {
return <FormListItem return <FormListItem
value={[ item.type, item.templateNoteId ].join(",") } value={[ item.type, item.templateNoteId ].join(",") }
icon={item.uiIcon}> icon={item.uiIcon}>
{item.title} {item.title}
{item.badges && item.badges.map((badge) => <Badge {...badge} />)} {item.badges && item.badges.map((badge) => <Badge {...badge} />)}
</FormListItem>; </FormListItem>;
} }
})} })}
</FormList> </FormList>