mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 01:28:55 +00:00
fix(ci): typed card points, the managed take route, and the failing card tests and ratchets
This commit is contained in:
@@ -81,11 +81,15 @@ describe('useTourDeepLink', () => {
|
||||
late.planner.tours = [{ place_id: 41 }];
|
||||
late.hook.rerender();
|
||||
expect(late.workspace.openTourInPlanner).toHaveBeenCalledWith(41);
|
||||
act(() => vi.advanceTimersByTime(3000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(3000);
|
||||
});
|
||||
expect(late.planner.toast.error).not.toHaveBeenCalled();
|
||||
|
||||
const loading = setup({ tours: [], ready: false });
|
||||
act(() => vi.advanceTimersByTime(5000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(5000);
|
||||
});
|
||||
expect(loading.planner.invalidateTourPlaceIds).not.toHaveBeenCalled();
|
||||
expect(loading.planner.toast.error).not.toHaveBeenCalled();
|
||||
expect(loading.params.get('tour')).toBe('41');
|
||||
@@ -93,7 +97,9 @@ describe('useTourDeepLink', () => {
|
||||
const missing = setup({ tours: [] });
|
||||
missing.hook.rerender();
|
||||
expect(missing.planner.invalidateTourPlaceIds).toHaveBeenCalledTimes(1);
|
||||
act(() => vi.advanceTimersByTime(3000));
|
||||
act(() => {
|
||||
vi.advanceTimersByTime(3000);
|
||||
});
|
||||
expect(missing.planner.toast.error).toHaveBeenCalledWith('tours.planner.openFailed');
|
||||
expect(missing.params.get('tour')).toBeNull();
|
||||
expect(missing.workspace.openTourInPlanner).not.toHaveBeenCalled();
|
||||
|
||||
@@ -92,16 +92,10 @@ function useCssColor(): (value: string) => string {
|
||||
const theme = useMapPaint(THEME_PROBE);
|
||||
return useMemo(() => {
|
||||
const style = typeof document === 'undefined' ? null : getComputedStyle(document.documentElement);
|
||||
const resolved = new Map<string, string>();
|
||||
return (value: string) => {
|
||||
const token = /^var\((--[\w-]+)\)$/.exec(value.trim())?.[1];
|
||||
if (!token) return value;
|
||||
let color = resolved.get(token);
|
||||
if (color === undefined) {
|
||||
color = style?.getPropertyValue(token).trim() || theme.accent;
|
||||
resolved.set(token, color);
|
||||
}
|
||||
return color;
|
||||
return style?.getPropertyValue(token).trim() || theme.accent;
|
||||
};
|
||||
}, [theme]);
|
||||
}
|
||||
@@ -193,16 +187,14 @@ export function useAssistantRouteLines({ tripId, isMobile, autoAllowed }: RouteL
|
||||
|
||||
const ghosts = useMemo(
|
||||
() =>
|
||||
cardGhosts(refs, CARD_MAP_LOOK).map(
|
||||
(ghost): AssistantGhost => ({
|
||||
id: ghost.id,
|
||||
ref: ghost.ref,
|
||||
lat: ghost.lat,
|
||||
lng: ghost.lng,
|
||||
name: ghost.name,
|
||||
variant: ghost.variant ?? 'pin',
|
||||
})
|
||||
),
|
||||
cardGhosts(refs, CARD_MAP_LOOK).map((ghost): AssistantGhost => ({
|
||||
id: ghost.id,
|
||||
ref: ghost.ref,
|
||||
lat: ghost.lat,
|
||||
lng: ghost.lng,
|
||||
name: ghost.name,
|
||||
variant: ghost.variant ?? 'pin',
|
||||
})),
|
||||
[refs]
|
||||
);
|
||||
const hiddenGhosts = useMemo(() => cardHiddenGhosts(refs, CARD_MAP_LOOK), [refs]);
|
||||
|
||||
Reference in New Issue
Block a user