feat: add isMobile prop to calendar views and time grid interactions
This commit is contained in:
@@ -119,6 +119,7 @@ export function CalendarDayView({
|
||||
created: t("notifications.event_created"),
|
||||
error: t("notifications.event_error"),
|
||||
},
|
||||
isMobile,
|
||||
});
|
||||
|
||||
const formatHour = (h: number): string => {
|
||||
|
||||
@@ -183,6 +183,7 @@ export function CalendarWeekView({
|
||||
created: t("notifications.event_created"),
|
||||
error: t("notifications.event_error"),
|
||||
},
|
||||
isMobile,
|
||||
});
|
||||
|
||||
const formatHour = (h: number): string => {
|
||||
|
||||
@@ -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<HTMLDivElement>) => {
|
||||
if (!dragRef.current) return;
|
||||
|
||||
Reference in New Issue
Block a user