From 7f7eaea2b1fddb1248a2c40c6bea2f15b2ed0526 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 5 Sep 2025 16:28:34 +0300 Subject: [PATCH] chore(react/collections/calendar): hide weekends & week numbers --- apps/client/src/widgets/collections/calendar/index.tsx | 6 +++++- apps/client/src/widgets/view_widgets/calendar_view.ts | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsx index b14fd889d..73bce3585 100644 --- a/apps/client/src/widgets/collections/calendar/index.tsx +++ b/apps/client/src/widgets/collections/calendar/index.tsx @@ -3,7 +3,7 @@ import { ViewModeProps } from "../interface"; import Calendar from "./calendar"; import { useEffect, useState } from "preact/hooks"; import "./index.css"; -import { useTriliumOption, useTriliumOptionInt } from "../../react/hooks"; +import { useNoteLabel, useNoteLabelBoolean, useTriliumOption, useTriliumOptionInt } from "../../react/hooks"; interface CalendarViewData { @@ -19,6 +19,8 @@ const CALENDAR_VIEWS = [ export default function CalendarView({ note, noteIds }: ViewModeProps) { const plugins = usePlugins(false, false); const [ firstDayOfWeek ] = useTriliumOptionInt("firstDayOfWeek"); + const [ hideWeekends ] = useNoteLabelBoolean(note, "calendar:hideWeekends"); + const [ weekNumbers ] = useNoteLabelBoolean(note, "calendar:weekNumbers"); return (plugins &&
@@ -31,6 +33,8 @@ export default function CalendarView({ note, noteIds }: ViewModeProps
); diff --git a/apps/client/src/widgets/view_widgets/calendar_view.ts b/apps/client/src/widgets/view_widgets/calendar_view.ts index 370f841fb..b738bc2c1 100644 --- a/apps/client/src/widgets/view_widgets/calendar_view.ts +++ b/apps/client/src/widgets/view_widgets/calendar_view.ts @@ -91,8 +91,6 @@ export default class CalendarView extends ViewMode<{}> { selectable: isEditable, select: (e) => this.#onCalendarSelection(e), eventChange: (e) => this.#onEventMoved(e), - weekends: !this.parentNote.hasAttribute("label", "calendar:hideWeekends"), - weekNumbers: this.parentNote.hasAttribute("label", "calendar:weekNumbers"), locale: await getFullCalendarLocale(options.get("locale")), height: "100%", nowIndicator: true,