diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 7dcf4b0..1274f4e 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -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('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] ); diff --git a/frontend/src/components/map/MapPage.tsx b/frontend/src/components/map/MapPage.tsx index beaecb3..a7a17bc 100644 --- a/frontend/src/components/map/MapPage.tsx +++ b/frontend/src/components/map/MapPage.tsx @@ -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')); diff --git a/frontend/src/components/map/PropertiesPane.test.tsx b/frontend/src/components/map/PropertiesPane.test.tsx index 93993bc..63272ae 100644 --- a/frontend/src/components/map/PropertiesPane.test.tsx +++ b/frontend/src/components/map/PropertiesPane.test.tsx @@ -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']); }); diff --git a/frontend/src/lib/map-utils.test.ts b/frontend/src/lib/map-utils.test.ts index 8f74019..6f67f50 100644 --- a/frontend/src/lib/map-utils.test.ts +++ b/frontend/src/lib/map-utils.test.ts @@ -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', () => { diff --git a/server-rs/src/data/property/loading.rs b/server-rs/src/data/property/loading.rs index 46060a4..af006b4 100644 --- a/server-rs/src/data/property/loading.rs +++ b/server-rs/src/data/property/loading.rs @@ -914,8 +914,7 @@ impl PropertyData { // Re-key tenure_history by permuted row index let tenure_history: FxHashMap> = { - let mut map = - FxHashMap::with_capacity_and_hasher(tenure_raw.len(), Default::default()); + let mut map = FxHashMap::with_capacity_and_hasher(tenure_raw.len(), Default::default()); for (new_row, &old_row) in perm.iter().enumerate() { if let Some(events) = tenure_raw.remove(&old_row) { map.insert(new_row as u32, events); diff --git a/server-rs/src/demo_zone.rs b/server-rs/src/demo_zone.rs index 08cf81b..5f45975 100644 --- a/server-rs/src/demo_zone.rs +++ b/server-rs/src/demo_zone.rs @@ -73,8 +73,8 @@ fn demo_center_from_query(query: Option<&str>) -> Option<(f64, f64)> { /// Resolve a request's demo zone from its query params, falling back to Canary Wharf. pub fn resolve_demo_zone(query: Option<&str>) -> DemoZone { - let (lat, lon) = demo_center_from_query(query) - .unwrap_or((FREE_ZONE_FALLBACK_LAT, FREE_ZONE_FALLBACK_LON)); + let (lat, lon) = + demo_center_from_query(query).unwrap_or((FREE_ZONE_FALLBACK_LAT, FREE_ZONE_FALLBACK_LON)); DemoZone { free_zone: free_zone_around(lat, lon), } diff --git a/server-rs/src/licensing.rs b/server-rs/src/licensing.rs index 618a7e0..a10f5f9 100644 --- a/server-rs/src/licensing.rs +++ b/server-rs/src/licensing.rs @@ -10,8 +10,8 @@ use url::form_urlencoded; use crate::auth::PocketBaseUser; use crate::consts::{ - MAX_SHARE_LAT_SPAN, MAX_SHARE_LON_SPAN, MAX_SHARE_ZOOM, MIN_SHARE_ZOOM, SHARE_CACHE_MAX_ENTRIES, - SHARE_CACHE_TTL_SECS, + MAX_SHARE_LAT_SPAN, MAX_SHARE_LON_SPAN, MAX_SHARE_ZOOM, MIN_SHARE_ZOOM, + SHARE_CACHE_MAX_ENTRIES, SHARE_CACHE_TTL_SECS, }; use crate::demo_zone::FreeZone; use crate::pocketbase::get_superuser_token; diff --git a/server-rs/src/ratelimit.rs b/server-rs/src/ratelimit.rs index 0579890..bdb99ee 100644 --- a/server-rs/src/ratelimit.rs +++ b/server-rs/src/ratelimit.rs @@ -127,7 +127,10 @@ fn is_internal_request(headers: &HeaderMap, peer: Option) -> bool { fn filter_count(query: &str) -> usize { for (key, value) in form_urlencoded::parse(query.as_bytes()) { if key == "filters" { - return value.split(";;").filter(|entry| !entry.trim().is_empty()).count(); + return value + .split(";;") + .filter(|entry| !entry.trim().is_empty()) + .count(); } } 0 @@ -157,7 +160,10 @@ pub async fn demo_guard_middleware(req: Request, next: Next) -> Response { } // Licensed users and admins bypass demo guards entirely. - let user = req.extensions().get::().and_then(|u| u.0.clone()); + let user = req + .extensions() + .get::() + .and_then(|u| u.0.clone()); if let Some(u) = &user { if u.is_admin || u.subscription == "licensed" { return next.run(req).await; diff --git a/server-rs/src/routes/actual_listings.rs b/server-rs/src/routes/actual_listings.rs index 6c6e39d..4bd3629 100644 --- a/server-rs/src/routes/actual_listings.rs +++ b/server-rs/src/routes/actual_listings.rs @@ -71,7 +71,12 @@ pub async fn get_actual_listings( require_bounds(params.bounds).map_err(IntoResponse::into_response)?; let share_bounds = resolve_share_code(&state, params.share.as_deref()).await; - check_license_bounds(&user.0, (south, west, north, east), geo.free_zone, share_bounds)?; + check_license_bounds( + &user.0, + (south, west, north, east), + geo.free_zone, + share_bounds, + )?; let quant = state.data.quant_ref(); let poi_quant = state.data.poi_metrics.quant_ref(); diff --git a/server-rs/src/routes/export.rs b/server-rs/src/routes/export.rs index 347cdea..1d8491f 100644 --- a/server-rs/src/routes/export.rs +++ b/server-rs/src/routes/export.rs @@ -502,7 +502,12 @@ pub async fn get_export( } let share_bounds = resolve_share_code(&state, params.share.as_deref()).await; - check_license_bounds(&user.0, (south, west, north, east), geo.free_zone, share_bounds)?; + check_license_bounds( + &user.0, + (south, west, north, east), + geo.free_zone, + share_bounds, + )?; let quant = state.data.quant_ref(); let poi_quant = state.data.poi_metrics.quant_ref(); diff --git a/server-rs/src/routes/filter_counts.rs b/server-rs/src/routes/filter_counts.rs index 0061bd1..364fab4 100644 --- a/server-rs/src/routes/filter_counts.rs +++ b/server-rs/src/routes/filter_counts.rs @@ -41,7 +41,12 @@ pub async fn get_filter_counts( let (south, west, north, east) = require_bounds(params.bounds).map_err(IntoResponse::into_response)?; let share_bounds = resolve_share_code(&state, params.share.as_deref()).await; - check_license_bounds(&user.0, (south, west, north, east), geo.free_zone, share_bounds)?; + check_license_bounds( + &user.0, + (south, west, north, east), + geo.free_zone, + share_bounds, + )?; let quant = state.data.quant_ref(); let poi_quant = state.data.poi_metrics.quant_ref(); diff --git a/server-rs/src/routes/hexagons.rs b/server-rs/src/routes/hexagons.rs index d6077e0..0824d72 100644 --- a/server-rs/src/routes/hexagons.rs +++ b/server-rs/src/routes/hexagons.rs @@ -263,7 +263,12 @@ pub async fn get_hexagons( require_bounds(params.bounds).map_err(IntoResponse::into_response)?; let share_bounds = resolve_share_code(&state, params.share.as_deref()).await; - check_license_bounds(&user.0, (south, west, north, east), geo.free_zone, share_bounds)?; + check_license_bounds( + &user.0, + (south, west, north, east), + geo.free_zone, + share_bounds, + )?; let quant = state.data.quant_ref(); let poi_quant = state.data.poi_metrics.quant_ref(); diff --git a/server-rs/src/routes/postcodes.rs b/server-rs/src/routes/postcodes.rs index 18a3219..5203453 100644 --- a/server-rs/src/routes/postcodes.rs +++ b/server-rs/src/routes/postcodes.rs @@ -62,7 +62,12 @@ pub async fn get_postcodes( require_bounds(params.bounds).map_err(IntoResponse::into_response)?; let share_bounds = resolve_share_code(&state, params.share.as_deref()).await; - check_license_bounds(&user.0, (south, west, north, east), geo.free_zone, share_bounds)?; + check_license_bounds( + &user.0, + (south, west, north, east), + geo.free_zone, + share_bounds, + )?; let quant = state.data.quant_ref(); let poi_quant = state.data.poi_metrics.quant_ref();