Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(calendar): dropdown-based view switcher for mobile
Elian Doran305f195539c4
diff --git a/apps/client/src/widgets/collections/calendar/index.tsx b/apps/client/src/widgets/collections/calendar/index.tsxindex 2f99821df7..1d35c46ab3 100644--- a/apps/client/src/widgets/collections/calendar/index.tsx+++ b/apps/client/src/widgets/collections/calendar/index.tsx@@ -17,6 +17,8 @@ import { isMobile } from "../../../services/utils";import CollectionProperties from "../../note_bars/CollectionProperties";import ActionButton from "../../react/ActionButton";import Button, { ButtonGroup } from "../../react/Button";+import Dropdown from "../../react/Dropdown";+import { FormListItem } from "../../react/FormList";import { useNoteLabel, useNoteLabelBoolean, useResizeObserver, useSpacedUpdate, useTriliumEvent, useTriliumOption, useTriliumOptionInt } from "../../react/hooks";import { ParentComponent } from "../../react/react_utils";import TouchBar, { TouchBarButton, TouchBarLabel, TouchBarSegmentedControl, TouchBarSpacer } from "../../react/TouchBar";@@ -192,6 +194,24 @@ function CalendarHeaderCenter({ calendarRef }: { calendarRef: RefObject<FullCalefunction CalendarHeaderRight({ calendarRef }: { calendarRef: RefObject<FullCalendar> }) {const { viewType: currentViewType } = useOnDatesSet(calendarRef);+ const currentViewTypeData = CALENDAR_VIEWS.find(view => view.type === currentViewType);++ if (isMobile()) {+ return (+ <Dropdown+ text={currentViewTypeData?.name}+ >+ {CALENDAR_VIEWS.map(viewData => (+ <FormListItem+ key={viewData.type}+ selected={currentViewType === viewData.type}+ icon={viewData.icon}+ onClick={() => calendarRef.current?.changeView(viewData.type)}+ >{viewData.name}</FormListItem>+ ))}+ </Dropdown>+ );+ }return (<>