feat(view/calendar): improve display when creating empty note

This commit is contained in:
Elian Doran 2025-02-16 19:17:15 +02:00
parent e73ea36161
commit 169b2269b1
No known key found for this signature in database
3 changed files with 13 additions and 4 deletions

View File

@ -290,7 +290,7 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
return (
this.note &&
["default", "contextual-help"].includes(this.viewScope?.viewMode ?? "") &&
this.note.hasChildren() &&
(this.note.hasChildren() || this.note.getLabelValue("viewType") === "calendar") &&
["book", "text", "code"].includes(this.note.type) &&
this.note.mime !== "text/x-sqlite;schema=trilium" &&
!this.note.isLabelTruthy("hideChildrenOverview")

View File

@ -107,8 +107,7 @@ export default class NoteListWidget extends NoteContextAwareWidget {
entitiesReloadedEvent(e: EventData<"entitiesReloaded">) {
if (e.loadResults.getAttributeRows().find((attr) => attr.noteId === this.noteId && attr.name && ["viewType", "expanded", "pageSize"].includes(attr.name))) {
this.shownNoteId = null; // force render
this.refresh();
this.checkRenderStatus();
}

View File

@ -1,6 +1,7 @@
import TypeWidget from "./type_widget.js";
import { t } from "../../services/i18n.js";
import type FNote from "../../entities/fnote.js";
import type { EventData } from "../../components/app_context.js";
const TPL = `
<div class="note-detail-book note-detail-printable">
@ -35,6 +36,15 @@ export default class BookTypeWidget extends TypeWidget {
}
async doRefresh(note: FNote) {
this.$helpNoChildren.toggle(!this.note?.hasChildren());
this.$helpNoChildren.toggle(
!this.note?.hasChildren()
&& this.note?.getAttributeValue("label", "viewType") !== "calendar");
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
if (loadResults.getAttributeRows().find((attr) => attr.noteId === this.noteId && attr.name === "viewType")) {
this.refresh();
}
}
}