From 4b069808d65d47b9434464589129c5a6b3f392fc Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Wed, 22 Apr 2026 20:37:00 +0200 Subject: [PATCH] feat: add isMobile prop to calendar views and time grid interactions --- components/calendar/calendar-day-view.tsx | 1 + components/calendar/calendar-week-view.tsx | 1 + hooks/use-time-grid-interactions.ts | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/components/calendar/calendar-day-view.tsx b/components/calendar/calendar-day-view.tsx index 62e0d554..3dd516d9 100644 --- a/components/calendar/calendar-day-view.tsx +++ b/components/calendar/calendar-day-view.tsx @@ -119,6 +119,7 @@ export function CalendarDayView({ created: t("notifications.event_created"), error: t("notifications.event_error"), }, + isMobile, }); const formatHour = (h: number): string => { diff --git a/components/calendar/calendar-week-view.tsx b/components/calendar/calendar-week-view.tsx index 19aa3d8e..369e5fe4 100644 --- a/components/calendar/calendar-week-view.tsx +++ b/components/calendar/calendar-week-view.tsx @@ -183,6 +183,7 @@ export function CalendarWeekView({ created: t("notifications.event_created"), error: t("notifications.event_error"), }, + isMobile, }); const formatHour = (h: number): string => { diff --git a/hooks/use-time-grid-interactions.ts b/hooks/use-time-grid-interactions.ts index 675628cc..5b5e1355 100644 --- a/hooks/use-time-grid-interactions.ts +++ b/hooks/use-time-grid-interactions.ts @@ -40,6 +40,7 @@ interface UseTimeGridInteractionsOptions { created: string; error: string; }; + isMobile?: boolean; } export function useTimeGridInteractions({ @@ -47,6 +48,7 @@ export function useTimeGridInteractions({ calendars, onCreateRange, errorMessages, + isMobile, }: UseTimeGridInteractionsOptions) { const snapToMinutes = useCallback((clientY: number, containerTop: number): number => { const raw = ((clientY - containerTop) / hourHeight) * 60; @@ -72,6 +74,7 @@ export function useTimeGridInteractions({ dayKey: string, dayDate: Date, ) => { + if (isMobile) return; if (e.button !== 0) return; if ((e.target as HTMLElement).closest("[data-calendar-event], [data-resize-handle]")) return; @@ -82,7 +85,7 @@ export function useTimeGridInteractions({ dayKey, dayDate, startMinutes: minutes, pointerId: e.pointerId, startY: e.clientY, captured: false, }; - }, [snapToMinutes]); + }, [snapToMinutes, isMobile]); const handleGridPointerMove = useCallback((e: PointerEvent) => { if (!dragRef.current) return;