feat(views/calendar): basic recursion for calendar root

This commit is contained in:
Elian Doran 2025-02-22 09:47:48 +02:00
parent 530340f753
commit f4e6edd19e
No known key found for this signature in database

View File

@ -215,10 +215,17 @@ export default class CalendarView extends ViewMode {
const events: EventSourceInput = []; const events: EventSourceInput = [];
for (const note of notes) { for (const note of notes) {
const startDate = note.getAttributeValue("label", "startDate"); const startDate = note.getLabelValue("startDate") ?? note.getLabelValue("dateNote");
const customTitle = note.getAttributeValue("label", "calendar:title"); const customTitle = note.getAttributeValue("label", "calendar:title");
const color = note.getAttributeValue("label", "calendar:color") ?? note.getAttributeValue("label", "color") ?? undefined; const color = note.getAttributeValue("label", "calendar:color") ?? note.getAttributeValue("label", "color") ?? undefined;
if (note.hasChildren()) {
const childrenEventData = await this.#buildEvents(note.getChildNoteIds());
if (childrenEventData.length > 0) {
events.push(childrenEventData);
}
}
if (!startDate) { if (!startDate) {
continue; continue;
} }
@ -243,7 +250,7 @@ export default class CalendarView extends ViewMode {
} }
} }
return events; return events.flat();
} }
static async #parseCustomTitle(customTitleValue: string | null, note: FNote, allowRelations = true): Promise<string[]> { static async #parseCustomTitle(customTitleValue: string | null, note: FNote, allowRelations = true): Promise<string[]> {