fix(sf-fe): poi-score TypeError + drawer non-overlay + CSS design tokens #353
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#353
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/sf-fe-ui-alignment-typeerror"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
r is not iterableon/site-finder/analysis/[cad]: Backend/parcels/{cad}/poi-scorereturns{cad_num, radius_m, top_poi:[...]}butuseParcelPoiScoreQueryexpected{items, poi_weighted_score}. Added adapter in queryFn that mapstop_poitoitemsand computespoi_weighted_scorefromweightfield. P0 fix, no backend changes.position:fixedover the whole page, causing the right sidebar (CadInput + RecentParcels + ParcelLegend) to hide. Fix: drawer is nowposition:absolutewithin the map container (parent hasposition:relative), overlapping only the map area. CadInput stays always visible.var(--bg-card),var(--accent),var(--fg-primary)etc. were referenced but never defined — the Site Finder UI was invisible/unstyled. Createdfrontend/src/app/globals.csswith all tokens from UI_Brief_GenDesign_May17. Imported inlayout.tsx. Also setsfont-variant-numeric:tabular-numsglobally per design brief.Test plan
/site-finder/analysis/66:41:0204016:10— no TypeError, POI list renders/site-finder— click parcel — drawer over map only, right sidebar remains visibletsc --noEmitpasses on modified filesnext lintpassesBug A — TypeError 'r is not iterable' on /site-finder/analysis/[cad]: Backend /parcels/{cad}/poi-score returns {cad_num, radius_m, top_poi:[...]} but useParcelPoiScoreQuery expected {items, poi_weighted_score}. Added adapter in queryFn that maps top_poi → items and computes poi_weighted_score from weight field. No backend changes needed. Bug B — Sidebar hides on parcel select (bad UX): ParcelDrawer was position:fixed over the whole page, causing sidebar (CadInput + RecentParcels + ParcelLegend) to hide. Fix: drawer is now position:absolute within the map container (parent given position:relative), overlapping only the map area. Sidebar stays permanently visible so user can type a cad directly alongside the drawer. Bug C — CSS design tokens missing (all var(--*) undefined): Created frontend/src/app/globals.css with all design tokens from UI_Brief_GenDesign_May17 (surface, border, text, brand, semantic, viz). Imported in layout.tsx. Removes invisible UI caused by undefined CSS vars. Also sets font-variant-numeric: tabular-nums globally per brief.Deep Code Review — verdict: APPROVE
Summary
807eb9ae(single commit, matches my scan)Bug A — POI adapter (
site-finder-api.ts)Clean.
PoiScoreRawis precise (noany), nullish-coalescing ontop_poi ?? []handles missing-key case,reduce(..., 0)initial value prevents NaN on empty list.Section1ParcelInfo.tsxconsumer keeps the stablePoiScoreResponsecontract — no downstream churn.Minor:
score_contribution: Math.round(p.weight * 100)assumesweight ∈ [0,1]per item — if backend ever returns un-normalized weights, the computedpoi_weighted_scorecould exceed expected bounds. Not blocking (matches B6 contract from #333).Bug B — Drawer
position:absolute+ sidebar always visibleif (!parcel) return null;retained → drawer self-gates render. OK.position: relative(page.tsx:158) so absolute anchor works. OK.role="dialog"+ aria-label retained. No focus trap existed before either — no regression.Trade-off (acceptable): old backdrop
<div onClick={onClose} inset:0>is gone, so click-outside-to-close no longer works. Close is via X button or map deselect. Per design brief this is intentional — drawer no longer occludes anything outside the map, so backdrop is unnecessary.Cosmetic nit (not blocking): drawer style sets both
borderLeft: 1px solid var(--border-card)andborder: 1px solid var(--border-card)on lines 1087-1088 — the shorthandborderoverridesborderLeft, so theborderLeftline is dead. Squash if you touch the file again.Bug C —
globals.css--bg-card,--bg-card-alt,--bg-headline,--bg-app,--border-soft/card/strong,--fg-primary/secondary/tertiary,--fg-on-dark,--fg-on-dark-muted,--accent,--accent-hover,--accent-soft,--accent-2,--success,--success-soft,--warn,--warn-soft,--danger,--danger-soft, viz-1..5, prediction line/band.font-variant-numeric: tabular-nums+font-feature-settings: "tnum"on body — matches brief.:focus-visiblering uses--accent— a11y-correct.tailwindcss@^4in deps without a postcss.config / @tailwindcss/postcss wiring or@import "tailwindcss"anywhere. Codebase uses inlinestyle={...}exclusively, so Tailwind utilities are not active either pre- or post-PR. No new conflict; just noting this dep is dead weight.* { box-sizing: border-box }is a behavior shift but low risk: layout uses flex/grid with inline px, no measurable regression.html, body { font-size: 14px }global — could shift anyem/remusage. Codebase uses absolute px → low impact.Cross-file impact analysis
useParcelPoiScoreQueryconsumers (Section1ParcelInfo.tsx,PoiList2Gis.tsx) unchanged contract. ✅ParcelDraweronly consumer issite-finder/page.tsx, updated. ✅layout.tsxbody inline-style removed in favor of globals.css equivalents. ✅tabular-numsper-component inline declarations now redundant (set globally) — keep them; they don't conflict.Conventions
any.dangerouslySetInnerHTML.Pre-flight
--no-verify/ force / amend in history (single commit).main@9ffeee7e.Blast-radius score
Merging via deep-code-reviewer.