Skip to content

Build your personal knowledge base with Trilium Notes

feat(book/table): hide no children warning

Elian Doran5450bdeae9d4
diff --git a/apps/client/src/widgets/type_widgets/book.ts b/apps/client/src/widgets/type_widgets/book.ts
index 9b11129bb1..66d4764644 100644
--- a/apps/client/src/widgets/type_widgets/book.ts
+++ b/apps/client/src/widgets/type_widgets/book.ts
@@ -36,7 +36,21 @@ export default class BookTypeWidget extends TypeWidget {
}
async doRefresh(note: FNote) {
- this.$helpNoChildren.toggle(!this.note?.hasChildren() && this.note?.getAttributeValue("label", "viewType") !== "calendar");
+ this.$helpNoChildren.toggle(this.shouldDisplayNoChildrenWarning());
+ }
+
+ shouldDisplayNoChildrenWarning() {
+ if (this.note?.hasChildren()) {
+ return false;
+ }
+
+ switch (this.note?.getAttributeValue("label", "viewType")) {
+ case "calendar":
+ case "table":
+ return false;
+ default:
+ return true;
+ }
}
entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {