chore(react/collections/calendar): hide weekends & week numbers

This commit is contained in:
Elian Doran
2025-09-05 16:28:34 +03:00
parent d33b1eb394
commit 7f7eaea2b1
2 changed files with 5 additions and 3 deletions

View File

@@ -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<CalendarViewData>) {
const plugins = usePlugins(false, false);
const [ firstDayOfWeek ] = useTriliumOptionInt("firstDayOfWeek");
const [ hideWeekends ] = useNoteLabelBoolean(note, "calendar:hideWeekends");
const [ weekNumbers ] = useNoteLabelBoolean(note, "calendar:weekNumbers");
return (plugins &&
<div className="calendar-view">
@@ -31,6 +33,8 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi
end: `${CALENDAR_VIEWS.join(",")} today prev,next`
}}
firstDay={firstDayOfWeek ?? 0}
weekends={!hideWeekends}
weekNumbers={weekNumbers}
/>
</div>
);

View File

@@ -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,