Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(collections/calendar): support archived notes
Elian Doran0c0bcb87f9e0
diff --git a/apps/client/src/widgets/collections/calendar/event_builder.ts b/apps/client/src/widgets/collections/calendar/event_builder.tsindex 3ea4c10013..8687dc6d90 100644--- a/apps/client/src/widgets/collections/calendar/event_builder.ts+++ b/apps/client/src/widgets/collections/calendar/event_builder.ts@@ -8,7 +8,8 @@ interface Event {startDate: string,endDate?: string | null,startTime?: string | null,- endTime?: string | null+ endTime?: string | null,+ isArchived?: boolean;}export async function buildEvents(noteIds: string[]) {@@ -25,7 +26,8 @@ export async function buildEvents(noteIds: string[]) {const endDate = getCustomisableLabel(note, "endDate", "calendar:endDate");const startTime = getCustomisableLabel(note, "startTime", "calendar:startTime");const endTime = getCustomisableLabel(note, "endTime", "calendar:endTime");- events.push(await buildEvent(note, { startDate, endDate, startTime, endTime }));+ const isArchived = note.hasLabel("archived");+ events.push(await buildEvent(note, { startDate, endDate, startTime, endTime, isArchived }));}return events.flat();@@ -75,7 +77,7 @@ export async function buildEventsForCalendar(note: FNote, e: EventSourceFuncArg)return events.flat();}-export async function buildEvent(note: FNote, { startDate, endDate, startTime, endTime }: Event) {+export async function buildEvent(note: FNote, { startDate, endDate, startTime, endTime, isArchived }: Event) {const customTitleAttributeName = note.getLabelValue("calendar:title");const titles = await parseCustomTitle(customTitleAttributeName, note);const color = note.getLabelValue("calendar:color") ?? note.getLabelValue("color");@@ -108,7 +110,8 @@ export async function buildEvent(note: FNote, { startDate, endDate, startTime, enoteId: note.noteId,color: color ?? undefined,iconClass: note.getLabelValue("iconClass"),- promotedAttributes: displayedAttributesData+ promotedAttributes: displayedAttributesData,+ className: isArchived ? "archived" : ""};if (endDate) {eventData.end = endDate;diff --git a/apps/client/src/widgets/collections/calendar/index.css b/apps/client/src/widgets/collections/calendar/index.cssindex c568586106..2255cc1d0a 100644--- a/apps/client/src/widgets/collections/calendar/index.css+++ b/apps/client/src/widgets/collections/calendar/index.css@@ -34,6 +34,10 @@text-decoration: none;}+.calendar-container a.fc-event.archived {+ opacity: 0.5;+}+.calendar-container .fc-button {padding: 0.2em 0.5em;}