From 84def1aa30accb568c7e6bb0105fc66aed7ba3c0 Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:51:48 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20show=20exist=20week=20no?= =?UTF-8?q?te=20when=20enable=20week=20note?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/public/app/widgets/buttons/calendar.ts | 8 ++++++++ 1 file changed, 8 insertions(+) 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"); }