fix(sf-fe): decode cad param (B5 400) + hide entry sidebar when drawer open #350

Closed
lekss361 wants to merge 2 commits from fix/sf-cad-decode-drawer-overlay into main

2 commits

Author SHA1 Message Date
lekss361
5b215def23 fix(sf-fe): decode cad URL param + hide entry sidebar when drawer open
Two prod issues:

1. Analysis page B5 endpoint returned HTTP 400 'Неверный формат
   кадастрового номера' for any cad. Next.js dynamic route delivers
   `params.cad` URL-encoded (':' -> '%3A'). Hooks then ran
   encodeURIComponent on the already-encoded string, producing
   /api/v1/parcels/66%253A41%253A0204016%253A10/analyze; FastAPI
   decoded one layer to '66%3A41%3A0204016%3A10', which the regex
   rejected. Fix: decodeURIComponent the param once at the page
   boundary so downstream consumers (hooks + breadcrumb + Section1)
   work with the canonical '66:41:0204016:10' and encode exactly
   once when building URLs. Also resolves the breadcrumb double-
   encode noted in PR #346 QA.

2. Entry page right-sidebar (CadInput + RecentParcels + ParcelLegend)
   visually overlapped the ParcelDrawer slide-in: both were anchored
   to the right edge with the drawer rendered above as an overlay
   without an opaque backdrop on the sidebar area. Conditional render:
   sidebar only mounts when no parcel is selected, so opening a parcel
   gives the drawer a clean right column.
2026-05-18 02:30:45 +03:00
lekss361
839cf05d8b fix(sf-fe): adapt by-bbox response shape + add CadInput on entry page
Two prod regressions noticed by user after #347 deploy ('не видно
участков · и нельзя просто ввести'):

1. Markers invisible — backend B1 returns
   { parcels: [{cad_num, centroid_lat, centroid_lon, area_m2, status, ...}], count, limit, bbox_area_km2 }
   but useParcelsBboxQuery typed the response as a flat ParcelBboxItem[]
   with fields { lat, lon, area_ha, district, vri, address, status }.
   Result: .map() iterated over an object (no markers rendered) and
   even if iterated, every CircleMarker got center=[undefined, undefined].
   Added an adapter in queryFn: unwrap .parcels, rename
   centroid_lat/centroid_lon -> lat/lon, convert area_m2 -> area_ha,
   default status to 'free' when null, placeholder district/vri/address
   until B1 enrichment lands. applyFilters still runs client-side.

2. No manual cad entry — A2 #343 dropped the existing CadInput component
   from the entry page when replacing placeholders. Re-wired it in the
   right sidebar above RecentParcels; submit -> router.push to
   /site-finder/analysis/{cad} (matches A1 routing scheme).
2026-05-18 02:17:05 +03:00