diff --git a/apps/calendar-web/src/common/utils/grid/grid.util.ts b/apps/calendar-web/src/common/utils/grid/grid.util.ts index 98174f979..9993515c1 100644 --- a/apps/calendar-web/src/common/utils/grid/grid.util.ts +++ b/apps/calendar-web/src/common/utils/grid/grid.util.ts @@ -67,7 +67,7 @@ export const SCROLL_TO_NOW_BUFFER_PX = 150; const SCROLL_TO_NOW_TOLERANCE_PX = 2; /** When the now line is visible and scroll is within this window, "t" pulses. */ -export const SCROLL_TO_NOW_PULSE_NEAR_MINUTES = 5; +const SCROLL_TO_NOW_PULSE_NEAR_MINUTES = 5; export const getScrollToNowTop = (clientHeight: number) => Math.max( @@ -76,7 +76,7 @@ export const getScrollToNowTop = (clientHeight: number) => SCROLL_TO_NOW_BUFFER_PX, ); -export const getScrollToNowDelta = (timedGrid: HTMLElement) => { +const getScrollToNowDelta = (timedGrid: HTMLElement) => { const targetTop = getScrollToNowTop(timedGrid.clientHeight); return Math.abs(timedGrid.scrollTop - targetTop); }; diff --git a/apps/calendar-web/src/components/SelectView/SelectView.tsx b/apps/calendar-web/src/components/SelectView/SelectView.tsx index 47de58fef..06038ded7 100644 --- a/apps/calendar-web/src/components/SelectView/SelectView.tsx +++ b/apps/calendar-web/src/components/SelectView/SelectView.tsx @@ -18,11 +18,7 @@ import { import { ROOT_ROUTES } from "@web/common/constants/routes"; import { Z_INDEX_FLOATING_MENU } from "@web/common/constants/web.constants"; import { ShortcutKeys } from "@web/components/Shortcuts/ShortcutKeys"; -import { - selectNowCueActive, - selectNowCuePulseGeneration, - useNowCueStore, -} from "@web/grid/now-cue/now-cue.store"; +import { useNowCuePulse } from "@web/grid/now-cue/useNowCuePulse"; import { useFloatingLayer } from "@web/shortcuts/floating-layer"; import { pageJumpAttrs } from "@web/shortcuts/page-jump/page-jump.targets"; import { pulseClickTaughtShortcut } from "@web/shortcuts/pointer-intent/pulseClickTaughtShortcut"; @@ -52,8 +48,8 @@ export const SelectView = ({ const navigate = useNavigate(); const listRef = useRef>([]); useFloatingLayer("viewSelect", isOpen); - const pulseDayLabel = useNowCueStore(selectNowCueActive) && emphasizeDayLabel; - const pulseGeneration = useNowCueStore(selectNowCuePulseGeneration); + const { pulsing, pulseKey } = useNowCuePulse(); + const pulseDayLabel = pulsing && emphasizeDayLabel; const getCurrentView = (): "Day" | "Week" | "Life" => { const pathname = location.pathname; @@ -188,11 +184,8 @@ export const SelectView = ({ aria-controls={isOpen ? dropdownId : undefined} > {label} diff --git a/apps/calendar-web/src/grid/components/TimedGrid.tsx b/apps/calendar-web/src/grid/components/TimedGrid.tsx index 9a8abfdb2..5892f7f82 100644 --- a/apps/calendar-web/src/grid/components/TimedGrid.tsx +++ b/apps/calendar-web/src/grid/components/TimedGrid.tsx @@ -23,11 +23,7 @@ import { TIMED_VISIBLE_HOURS, } from "@web/grid/grid.constants"; import { useGridMarginLeft } from "@web/grid/grid-margin"; -import { - selectNowCueActive, - selectNowCuePulseGeneration, - useNowCueStore, -} from "@web/grid/now-cue/now-cue.store"; +import { useNowCuePulse } from "@web/grid/now-cue/useNowCuePulse"; import { type GridVisibleDate } from "@web/grid/types/grid.types"; import { allDayColumnTintStyle } from "@web/grid/utils/allDayColumnTint.util"; import { @@ -164,17 +160,16 @@ const CalendarNowLine = ({ }) => { useMinuteTick(); const percentOfDay = getCurrentPercentOfDay(effectiveTimeZone); - const pulseNowLine = useNowCueStore(selectNowCueActive); - const pulseGeneration = useNowCueStore(selectNowCuePulseGeneration); + const { pulsing: pulseNowLine, pulseKey } = useNowCuePulse(); return (