mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-01 00:43:15 +00:00
e3541535e2
The iOS app pulls every file of a build into WebKit's cache so it can start offline. It did so four at a time at normal priority, for all 1,900 files of every new build including all 27 translations, and a page opened meanwhile queued behind it: right after a server update, a first visit to Vacay took five to seven seconds. The warm-up now runs two at a time at low priority, takes only the user's language and English, and walks a build once. The day rail in the trip header lit the new day only after the pager's snap had landed and the plan had re-rendered, a second or two after the swipe. The pager now reports the day a swipe heads for as soon as its page is the nearer one, and the rail and its pill move with the finger; the plan still switches when the snap lands.
18 lines
605 B
TypeScript
18 lines
605 B
TypeScript
import { create } from 'zustand';
|
|
|
|
/**
|
|
* The day a swipe is heading for, before the pager has settled on it. The day
|
|
* rail in the trip header lights that chip at once, the way a native tab strip
|
|
* follows the finger, while the plan itself switches only when the snap lands
|
|
* (MDayPager's onSelectDay). Null when no swipe is under way.
|
|
*/
|
|
interface DayPreviewState {
|
|
dayId: number | null;
|
|
setDayId: (dayId: number | null) => void;
|
|
}
|
|
|
|
export const useDayPreviewStore = create<DayPreviewState>((set) => ({
|
|
dayId: null,
|
|
setDayId: (dayId) => set((s) => (s.dayId === dayId ? s : { dayId })),
|
|
}));
|