feat(book/table): hide no children warning

This commit is contained in:
Elian Doran 2025-06-25 10:34:03 +03:00
parent fcd71957ff
commit 5450bdeae9
No known key found for this signature in database

View File

@ -36,7 +36,21 @@ export default class BookTypeWidget extends TypeWidget {
} }
async doRefresh(note: FNote) { 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">) { entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {