diff --git a/src/public/app/widgets/buttons/calendar.ts b/src/public/app/widgets/buttons/calendar.ts index ab73c1329c..ab4733d32f 100644 --- a/src/public/app/widgets/buttons/calendar.ts +++ b/src/public/app/widgets/buttons/calendar.ts @@ -95,6 +95,7 @@ export default class CalendarWidget extends RightDropdownButtonWidget { private todaysDate!: Dayjs; private date!: Dayjs; private weekNoteEnable: boolean = false; + private weekNotes: string[] = []; constructor(title: string = "", icon: string = "") { super(title, icon, DROPDOWN_TPL); @@ -309,6 +310,7 @@ export default class CalendarWidget extends RightDropdownButtonWidget { async dropdownShown() { await this.getWeekNoteEnable(); + this.weekNotes = await server.get(`attribute-values/weekNote`); this.init(appContext.tabManager.getActiveContextNote()?.getOwnedLabelValue("dateNote") ?? null); } @@ -351,6 +353,12 @@ export default class CalendarWidget extends RightDropdownButtonWidget { if (this.weekNoteEnable) { // Utilize the hover effect of calendar-date $newWeekNumber = $("").addClass("calendar-date"); + + if (this.weekNotes.includes(weekNoteId)) { + $newWeekNumber.addClass("calendar-date-exists"); + $newWeekNumber.attr("data-href", `#root/${weekNoteId}`); + } + } else { $newWeekNumber = $("").addClass("calendar-week-number-disabled"); }