refactor: remove haptic feedback triggers from calendar and duty components
- Eliminated triggerHapticLight calls from CalendarPage, CalendarDay, DayDetail, and DutyTimelineCard components to streamline user interaction. - This change focuses on improving performance and reducing unnecessary feedback in the user interface.
This commit is contained in:
@@ -17,7 +17,6 @@ import { CalendarGrid } from "@/components/calendar/CalendarGrid";
|
|||||||
import { DutyList } from "@/components/duty/DutyList";
|
import { DutyList } from "@/components/duty/DutyList";
|
||||||
import { DayDetail, type DayDetailHandle } from "@/components/day-detail";
|
import { DayDetail, type DayDetailHandle } from "@/components/day-detail";
|
||||||
import { ErrorState } from "@/components/states/ErrorState";
|
import { ErrorState } from "@/components/states/ErrorState";
|
||||||
import { triggerHapticLight } from "@/lib/telegram-haptic";
|
|
||||||
|
|
||||||
/** Fallback height (px) until ResizeObserver reports the sticky block size. Matches --calendar-block-min-height + pb-2 (260 + 8). */
|
/** Fallback height (px) until ResizeObserver reports the sticky block size. Matches --calendar-block-min-height + pb-2 (260 + 8). */
|
||||||
const STICKY_HEIGHT_FALLBACK_PX = 268;
|
const STICKY_HEIGHT_FALLBACK_PX = 268;
|
||||||
@@ -91,12 +90,10 @@ export function CalendarPage({ isAllowed, initDataRaw }: CalendarPageProps) {
|
|||||||
const navDisabled = loading || accessDenied || selectedDay !== null;
|
const navDisabled = loading || accessDenied || selectedDay !== null;
|
||||||
const handlePrevMonth = useCallback(() => {
|
const handlePrevMonth = useCallback(() => {
|
||||||
if (navDisabled) return;
|
if (navDisabled) return;
|
||||||
triggerHapticLight();
|
|
||||||
prevMonth();
|
prevMonth();
|
||||||
}, [navDisabled, prevMonth]);
|
}, [navDisabled, prevMonth]);
|
||||||
const handleNextMonth = useCallback(() => {
|
const handleNextMonth = useCallback(() => {
|
||||||
if (navDisabled) return;
|
if (navDisabled) return;
|
||||||
triggerHapticLight();
|
|
||||||
nextMonth();
|
nextMonth();
|
||||||
}, [navDisabled, nextMonth]);
|
}, [navDisabled, nextMonth]);
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import React, { useMemo } from "react";
|
|||||||
import { useTranslation } from "@/i18n/use-translation";
|
import { useTranslation } from "@/i18n/use-translation";
|
||||||
import { dateKeyToDDMM } from "@/lib/date-utils";
|
import { dateKeyToDDMM } from "@/lib/date-utils";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { triggerHapticLight } from "@/lib/telegram-haptic";
|
|
||||||
import type { DutyWithUser } from "@/types";
|
import type { DutyWithUser } from "@/types";
|
||||||
import { DayIndicators } from "./DayIndicators";
|
import { DayIndicators } from "./DayIndicators";
|
||||||
|
|
||||||
@@ -90,7 +89,6 @@ function CalendarDayInner({
|
|||||||
)}
|
)}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (isOtherMonth) return;
|
if (isOtherMonth) return;
|
||||||
triggerHapticLight();
|
|
||||||
onDayClick(dateKey, e.currentTarget.getBoundingClientRect());
|
onDayClick(dateKey, e.currentTarget.getBoundingClientRect());
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import { DayDetailContent } from "./DayDetailContent";
|
|||||||
import type { CalendarEvent, DutyWithUser } from "@/types";
|
import type { CalendarEvent, DutyWithUser } from "@/types";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { useAppStore } from "@/store/app-store";
|
import { useAppStore } from "@/store/app-store";
|
||||||
import { triggerHapticLight } from "@/lib/telegram-haptic";
|
|
||||||
|
|
||||||
/** Empty state for day detail: date and "no duties or events" message. */
|
/** Empty state for day detail: date and "no duties or events" message. */
|
||||||
function DayDetailEmpty({ dateKey }: { dateKey: string }) {
|
function DayDetailEmpty({ dateKey }: { dateKey: string }) {
|
||||||
@@ -121,7 +120,6 @@ export const DayDetail = React.forwardRef<DayDetailHandle, DayDetailProps>(
|
|||||||
|
|
||||||
/** Start close animation; actual unmount happens in onCloseAnimationEnd (or fallback timeout). */
|
/** Start close animation; actual unmount happens in onCloseAnimationEnd (or fallback timeout). */
|
||||||
const requestClose = React.useCallback(() => {
|
const requestClose = React.useCallback(() => {
|
||||||
triggerHapticLight();
|
|
||||||
setExiting(true);
|
setExiting(true);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import {
|
|||||||
formatHHMM,
|
formatHHMM,
|
||||||
} from "@/lib/date-utils";
|
} from "@/lib/date-utils";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { triggerHapticLight } from "@/lib/telegram-haptic";
|
|
||||||
import { ContactLinks } from "@/components/contact/ContactLinks";
|
import { ContactLinks } from "@/components/contact/ContactLinks";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import type { DutyWithUser } from "@/types";
|
import type { DutyWithUser } from "@/types";
|
||||||
@@ -78,7 +77,6 @@ export function DutyTimelineCard({
|
|||||||
const flipped = isControlled ? (isFlipped ?? false) : localFlipped;
|
const flipped = isControlled ? (isFlipped ?? false) : localFlipped;
|
||||||
|
|
||||||
const handleFlipToBack = () => {
|
const handleFlipToBack = () => {
|
||||||
triggerHapticLight();
|
|
||||||
if (isControlled) {
|
if (isControlled) {
|
||||||
onFlipChange?.(true);
|
onFlipChange?.(true);
|
||||||
} else {
|
} else {
|
||||||
@@ -88,7 +86,6 @@ export function DutyTimelineCard({
|
|||||||
};
|
};
|
||||||
|
|
||||||
const handleFlipToFront = () => {
|
const handleFlipToFront = () => {
|
||||||
triggerHapticLight();
|
|
||||||
if (isControlled) {
|
if (isControlled) {
|
||||||
onFlipChange?.(false);
|
onFlipChange?.(false);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user