This commit is contained in:
Andras Schmelczer 2026-06-17 08:05:22 +01:00
parent 4a0f00f2a4
commit 18ace123dc
13 changed files with 59 additions and 33 deletions

View file

@ -12,13 +12,7 @@ import {
} from './lib/seoRoutes';
import Header, { type Page } from './components/ui/Header';
import type { FeatureMeta, FeatureGroup, POICategoriesResponse, POICategoryGroup } from './types';
import {
fetchWithRetry,
apiUrl,
logNonAbortError,
readDemoChoice,
setDemoCenter,
} from './lib/api';
import { fetchWithRetry, apiUrl, logNonAbortError, readDemoChoice, setDemoCenter } from './lib/api';
import { trackEvent } from './lib/analytics';
import { parseUrlState } from './lib/url-state';
import pb from './lib/pocketbase';
@ -226,8 +220,7 @@ export default function App() {
const licensedAtMount = useMemo(
() =>
pb.authStore.isValid &&
(pb.authStore.record?.subscription === 'licensed' ||
pb.authStore.record?.is_admin === true),
(pb.authStore.record?.subscription === 'licensed' || pb.authStore.record?.is_admin === true),
[]
);
const initialDemoChoice = useMemo(() => {
@ -255,10 +248,7 @@ export default function App() {
);
const activePageRef = useRef<Page>('home');
const initialViewState = useMemo(
() =>
mapUrlState.hasExplicitView
? mapUrlState.viewState
: (demoView ?? INITIAL_VIEW_STATE),
() => (mapUrlState.hasExplicitView ? mapUrlState.viewState : (demoView ?? INITIAL_VIEW_STATE)),
[mapUrlState.hasExplicitView, mapUrlState.viewState, demoView]
);

View file

@ -522,7 +522,12 @@ export default function MapPage({
setDemoPromptOpen(false);
// handleFlyTo uses map.jumpTo (instant) — no flashing 403s through
// intermediate viewports; the move triggers a refetch carrying demoLat/Lon.
mapFlyToRef.current?.(center.lat, center.lon, INITIAL_VIEW_STATE.zoom, getMobileMapFlyToOptions());
mapFlyToRef.current?.(
center.lat,
center.lon,
INITIAL_VIEW_STATE.zoom,
getMobileMapFlyToOptions()
);
};
if (typeof navigator === 'undefined' || !navigator.geolocation) {
setDemoLocationError(t('locationSearch.geolocationUnsupported'));

View file

@ -32,8 +32,8 @@ describe('buildTimelineEvents', () => {
{ year: 2019, status: 'Rented (private)' },
{ year: 2023, status: 'Owner-occupied' },
],
}),
),
})
)
).toEqual(['tenure:Owner-occupied:2023', 'tenure:Rented (private):2019']);
});
@ -47,8 +47,8 @@ describe('buildTimelineEvents', () => {
{ year: 2024, month: 1, price: 300_000 },
],
tenure_history: [{ year: 2020, status: 'Rented (private)' }],
}),
),
})
)
).toEqual(['tenure:Rented (private):2020', 'sale:2015']);
});

View file

@ -29,8 +29,9 @@ describe('map utilities', () => {
expect(zoomToResolution(6.9)).toBe(5);
expect(zoomToResolution(7)).toBe(6);
expect(zoomToResolution(10.6)).toBe(8);
expect(zoomToResolution(14)).toBe(8);
expect(SMALLEST_VISIBLE_HEXAGON_RESOLUTION).toBe(8);
expect(zoomToResolution(12)).toBe(9);
expect(zoomToResolution(14)).toBe(9);
expect(SMALLEST_VISIBLE_HEXAGON_RESOLUTION).toBe(9);
});
it('computes exact viewport bounds by default', () => {