mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	feat(collections/calendar): support archived notes
This commit is contained in:
		@@ -8,7 +8,8 @@ interface Event {
 | 
				
			|||||||
    startDate: string,
 | 
					    startDate: string,
 | 
				
			||||||
    endDate?: string | null,
 | 
					    endDate?: string | null,
 | 
				
			||||||
    startTime?: string | null,
 | 
					    startTime?: string | null,
 | 
				
			||||||
    endTime?: string | null
 | 
					    endTime?: string | null,
 | 
				
			||||||
 | 
					    isArchived?: boolean;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export async function buildEvents(noteIds: string[]) {
 | 
					export async function buildEvents(noteIds: string[]) {
 | 
				
			||||||
@@ -25,7 +26,8 @@ export async function buildEvents(noteIds: string[]) {
 | 
				
			|||||||
        const endDate = getCustomisableLabel(note, "endDate", "calendar:endDate");
 | 
					        const endDate = getCustomisableLabel(note, "endDate", "calendar:endDate");
 | 
				
			||||||
        const startTime = getCustomisableLabel(note, "startTime", "calendar:startTime");
 | 
					        const startTime = getCustomisableLabel(note, "startTime", "calendar:startTime");
 | 
				
			||||||
        const endTime = getCustomisableLabel(note, "endTime", "calendar:endTime");
 | 
					        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();
 | 
					    return events.flat();
 | 
				
			||||||
@@ -75,7 +77,7 @@ export async function buildEventsForCalendar(note: FNote, e: EventSourceFuncArg)
 | 
				
			|||||||
    return events.flat();
 | 
					    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 customTitleAttributeName = note.getLabelValue("calendar:title");
 | 
				
			||||||
    const titles = await parseCustomTitle(customTitleAttributeName, note);
 | 
					    const titles = await parseCustomTitle(customTitleAttributeName, note);
 | 
				
			||||||
    const color = note.getLabelValue("calendar:color") ?? note.getLabelValue("color");
 | 
					    const color = note.getLabelValue("calendar:color") ?? note.getLabelValue("color");
 | 
				
			||||||
@@ -108,7 +110,8 @@ export async function buildEvent(note: FNote, { startDate, endDate, startTime, e
 | 
				
			|||||||
            noteId: note.noteId,
 | 
					            noteId: note.noteId,
 | 
				
			||||||
            color: color ?? undefined,
 | 
					            color: color ?? undefined,
 | 
				
			||||||
            iconClass: note.getLabelValue("iconClass"),
 | 
					            iconClass: note.getLabelValue("iconClass"),
 | 
				
			||||||
            promotedAttributes: displayedAttributesData
 | 
					            promotedAttributes: displayedAttributesData,
 | 
				
			||||||
 | 
					            className: isArchived ? "archived" : ""
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        if (endDate) {
 | 
					        if (endDate) {
 | 
				
			||||||
            eventData.end = endDate;
 | 
					            eventData.end = endDate;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,6 +34,10 @@
 | 
				
			|||||||
    text-decoration: none;
 | 
					    text-decoration: none;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.calendar-container a.fc-event.archived {
 | 
				
			||||||
 | 
					    opacity: 0.5;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.calendar-container .fc-button {
 | 
					.calendar-container .fc-button {
 | 
				
			||||||
    padding: 0.2em 0.5em;
 | 
					    padding: 0.2em 0.5em;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user