From 85e5f4d2c021829ccce4aa28a5a172926438d20f Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 6 Sep 2025 10:52:14 +0300 Subject: [PATCH] refactor(react/collections/calendar): add back clicking on date notes --- .../src/widgets/collections/calendar/index.tsx | 14 ++++++++++++++ .../src/widgets/view_widgets/calendar_view.ts | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsx index 1a4114251..be3607f96 100644 --- a/apps/client/src/widgets/collections/calendar/index.tsx +++ b/apps/client/src/widgets/collections/calendar/index.tsx @@ -15,6 +15,9 @@ import { t } from "../../../services/i18n"; import { buildEvents, buildEventsForCalendar } from "./event_builder"; import { changeEvent, newEvent } from "./api"; import froca from "../../../services/froca"; +import date_notes from "../../../services/date_notes"; +import appContext from "../../../components/app_context"; +import { DateClickArg } from "@fullcalendar/interaction"; interface CalendarViewData { @@ -92,6 +95,16 @@ export default function CalendarView({ note, noteIds }: ViewModeProps { + if (!isCalendarRoot) return; + + const eventNote = await date_notes.getDayNote(e.dateStr); + if (eventNote) { + appContext.triggerCommand("openInPopup", { noteIdOrPath: eventNote.noteId }); + } + }, []); + return (plugins &&
{ if (initialView.current !== view.type) { initialView.current = view.type; diff --git a/apps/client/src/widgets/view_widgets/calendar_view.ts b/apps/client/src/widgets/view_widgets/calendar_view.ts index 8448baf1a..d2e8bcc8d 100644 --- a/apps/client/src/widgets/view_widgets/calendar_view.ts +++ b/apps/client/src/widgets/view_widgets/calendar_view.ts @@ -86,18 +86,6 @@ export default class CalendarView extends ViewMode<{}> { $(mainContainer ?? e.el).append($(promotedAttributesHtml)); } }, - // Called upon when clicking the day number in the calendar, opens or creates the day note but only if in a calendar root. - dateClick: async (e) => { - if (!this.isCalendarRoot) { - return; - } - - const note = await date_notes.getDayNote(e.dateStr); - if (note) { - appContext.triggerCommand("openInPopup", { noteIdOrPath: note.noteId }); - appContext.triggerCommand("refreshNoteList", { noteId: this.parentNote.noteId }); - } - }, datesSet: (e) => this.#onDatesSet(e), });