mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	chore(react/collections/calendar): hide weekends & week numbers
This commit is contained in:
		| @@ -3,7 +3,7 @@ import { ViewModeProps } from "../interface"; | |||||||
| import Calendar from "./calendar"; | import Calendar from "./calendar"; | ||||||
| import { useEffect, useState } from "preact/hooks"; | import { useEffect, useState } from "preact/hooks"; | ||||||
| import "./index.css"; | import "./index.css"; | ||||||
| import { useTriliumOption, useTriliumOptionInt } from "../../react/hooks"; | import { useNoteLabel, useNoteLabelBoolean, useTriliumOption, useTriliumOptionInt } from "../../react/hooks"; | ||||||
|  |  | ||||||
| interface CalendarViewData { | interface CalendarViewData { | ||||||
|  |  | ||||||
| @@ -19,6 +19,8 @@ const CALENDAR_VIEWS = [ | |||||||
| export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarViewData>) { | export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarViewData>) { | ||||||
|     const plugins = usePlugins(false, false); |     const plugins = usePlugins(false, false); | ||||||
|     const [ firstDayOfWeek ] = useTriliumOptionInt("firstDayOfWeek"); |     const [ firstDayOfWeek ] = useTriliumOptionInt("firstDayOfWeek"); | ||||||
|  |     const [ hideWeekends ] = useNoteLabelBoolean(note, "calendar:hideWeekends"); | ||||||
|  |     const [ weekNumbers ] = useNoteLabelBoolean(note, "calendar:weekNumbers"); | ||||||
|  |  | ||||||
|     return (plugins && |     return (plugins && | ||||||
|         <div className="calendar-view"> |         <div className="calendar-view"> | ||||||
| @@ -31,6 +33,8 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi | |||||||
|                     end: `${CALENDAR_VIEWS.join(",")} today prev,next` |                     end: `${CALENDAR_VIEWS.join(",")} today prev,next` | ||||||
|                 }} |                 }} | ||||||
|                 firstDay={firstDayOfWeek ?? 0} |                 firstDay={firstDayOfWeek ?? 0} | ||||||
|  |                 weekends={!hideWeekends} | ||||||
|  |                 weekNumbers={weekNumbers} | ||||||
|             /> |             /> | ||||||
|         </div> |         </div> | ||||||
|     ); |     ); | ||||||
|   | |||||||
| @@ -91,8 +91,6 @@ export default class CalendarView extends ViewMode<{}> { | |||||||
|             selectable: isEditable, |             selectable: isEditable, | ||||||
|             select: (e) => this.#onCalendarSelection(e), |             select: (e) => this.#onCalendarSelection(e), | ||||||
|             eventChange: (e) => this.#onEventMoved(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")), |             locale: await getFullCalendarLocale(options.get("locale")), | ||||||
|             height: "100%", |             height: "100%", | ||||||
|             nowIndicator: true, |             nowIndicator: true, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user