feat(sf-fe-a1): routes shell — entry / analysis + _legacy/ backup + mock toggle #340

Merged
lekss361 merged 1 commit from feat/sf-fe-a1-routes into main 2026-05-17 22:01:50 +00:00
Owner

Summary

SF Frontend Migration Wave 1 first sequential. Shell-only PR — placeholders для A2/A3/A4/Sections/A12.

Files

  • frontend/src/app/_legacy/site-finder-page-tabs.tsxbackup existing tab-based page (reference for Wave 3 section refactor)
  • frontend/src/app/site-finder/page.tsx — NEW карта-first entry shell (MapPlaceholder + SidebarPlaceholder, TODO A2)
  • frontend/src/app/site-finder/analysis/[cad]/page.tsx — NEW analysis shell с React 19 use(params), 5 SectionPlaceholder с anchor IDs section-1..section-5 (TODO A4-A11)
  • frontend/src/lib/mock-toggle.tsUSE_MOCKS master env flag + per-endpoint fine-grained flags для B1-B6 progressive rollout

Mock toggle

export const USE_MOCKS = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
// + MOCK_PARCELS_BBOX / MOCK_RECENT_PARCELS / MOCK_LANDING_STATS / MOCK_ANALYZE / MOCK_POI_SCORE

Frontend не блокирован backend — каждый endpoint имеет отдельный flag.

Visual verify

  • /site-finder → header + map placeholder + sidebar placeholder
  • /site-finder/analysis/66:41:0701045:42 → header с cad_num + 5 section placeholders

Constraints соблюдены

  • TS strict (0 new errors; pre-existing module-not-found из-за worktree без node_modules)
  • App router only, "use client"
  • React 19 use(params) для Promise params
  • pre-commit pass (prettier + ESLint)

Next

После merge → spawn Wave 2 parallel: A2 entry map + A4 sidebar (different files). A3 primitives уже spawned параллельно (feat/sf-fe-a3-primitives).

Part of plan vault code/patterns/SiteFinder_Frontend_Migration_Plan_May18.md §A1.

## Summary SF Frontend Migration Wave 1 first sequential. Shell-only PR — placeholders для A2/A3/A4/Sections/A12. ## Files - `frontend/src/app/_legacy/site-finder-page-tabs.tsx` — **backup** existing tab-based page (reference for Wave 3 section refactor) - `frontend/src/app/site-finder/page.tsx` — NEW карта-first entry shell (MapPlaceholder + SidebarPlaceholder, TODO A2) - `frontend/src/app/site-finder/analysis/[cad]/page.tsx` — NEW analysis shell с React 19 `use(params)`, 5 SectionPlaceholder с anchor IDs `section-1`..`section-5` (TODO A4-A11) - `frontend/src/lib/mock-toggle.ts` — `USE_MOCKS` master env flag + per-endpoint fine-grained flags для B1-B6 progressive rollout ## Mock toggle ```typescript export const USE_MOCKS = process.env.NEXT_PUBLIC_USE_MOCKS === "true"; // + MOCK_PARCELS_BBOX / MOCK_RECENT_PARCELS / MOCK_LANDING_STATS / MOCK_ANALYZE / MOCK_POI_SCORE ``` Frontend не блокирован backend — каждый endpoint имеет отдельный flag. ## Visual verify - `/site-finder` → header + map placeholder + sidebar placeholder - `/site-finder/analysis/66:41:0701045:42` → header с cad_num + 5 section placeholders ## Constraints соблюдены - ✅ TS strict (0 new errors; pre-existing module-not-found из-за worktree без node_modules) - ✅ App router only, `"use client"` - ✅ React 19 `use(params)` для Promise params - ✅ pre-commit pass (prettier + ESLint) ## Next После merge → spawn Wave 2 parallel: A2 entry map + A4 sidebar (different files). A3 primitives уже spawned параллельно (`feat/sf-fe-a3-primitives`). Part of plan vault `code/patterns/SiteFinder_Frontend_Migration_Plan_May18.md` §A1.
lekss361 added 1 commit 2026-05-17 21:58:35 +00:00
- Move tab-based page.tsx to _legacy/site-finder-page-tabs.tsx (reference for Wave 2-4 section refactor)
- New /site-finder/page.tsx: карта-first entry shell with MapPlaceholder + SidebarPlaceholder (TODO A2: EntryMap / MapFilterBar / RecentParcels / ParcelLegend / ParcelDrawer)
- New /site-finder/analysis/[cad]/page.tsx: analysis shell with React 19 use(params), AnalysisSidebar placeholder, 5 SectionPlaceholder blocks (TODO A4-A11)
- New src/lib/mock-toggle.ts: USE_MOCKS master switch + per-endpoint flags (MOCK_PARCELS_BBOX / MOCK_RECENT_PARCELS / MOCK_LANDING_STATS / MOCK_ANALYZE / MOCK_POI_SCORE) for B1-B6 progressive rollout
Author
Owner

Deep Code Review — verdict: APPROVE

Files: 4 (P2: 2 routes, P3: 1 legacy backup + 1 lib helper) · Lines: +991/-531 · Time: ~12 min

Cross-file impact analysis

  • _legacy/site-finder-page-tabs.tsx — verified byte-identical to current main:frontend/src/app/site-finder/page.tsx (blob hash 568b146f0365336b726f394918e49af1d24e961e matches on both sides). Backup is faithful, zero data loss.
  • All imports inside legacy backup resolve against current tree (CadInput, FetchingState, KpiCard, OverviewTab, EnvironmentTab, LandTab, MarketTab, WeightProfilePanel, useSiteAnalysis, useDebouncedValue, useConnectionPoints, useCustomPois, POI_DEFAULT_WEIGHTS) — confirmed all 12 modules exist.
  • _legacy/ is underscore-prefixed → Next.js app router correctly excludes from routing. No accidental route exposure.
  • New analysis/[cad] route — no current callers in tree (expected: future A4 will wire it). No broken links.
  • package.json / package-lock.json untouched — zero new deps confirmed.

Correctness highlights

  • React 19 use(params) for Promise<{cad: string}> — correct Next 15 idiom
  • Anchor IDs section-1..section-5 literal & stable (no index keys, no dynamic IDs)
  • Mock toggle: strict === "true" equality prevents string "false" evaluating truthy
  • All five MOCK_* per-endpoint flags initially derive from USE_MOCKS — proper staged-rollout shape for B1–B6
  • Both pages have "use client" directive
  • No dangerouslySetInnerHTML, no user-controlled href, no XSS surface
  • TS strict: as const on inline-style narrowing (flexWrap: "wrap" as const) — clean

Vault cross-check

  • PR body references code/patterns/SiteFinder_Frontend_Migration_Plan_May18.md §A1 — proper traceability

Behavior at /site-finder after merge

Header (← Главная · SiteFinder · карта участков) + dashed-border MapPlaceholder + sidebar with 3 placeholder cards. Old tab-based analyze UI removed from live route — users lose CadInput entry & analyze flow until A2/A4 ship. Confirmed intentional per PR body. Rollback path: git mv _legacy/site-finder-page-tabs.tsx site-finder/page.tsx restores prior behavior byte-for-byte.

Notes (non-blocking)

  • All MOCK_* flags equal USE_MOCKS — no observable difference yet; pattern unlocks per-endpoint flips later. Fine.
  • _legacy/ becomes dead code after Wave 3 section refactor — schedule removal in plan.

Risk / reversibility

  • Risk: Low — shell-only, no logic, no schema, no API, no deps
  • Reversibility: Trivial revert via git mv
  • Merge window: anytime

Merging as squash.

## Deep Code Review — verdict: APPROVE **Files**: 4 (P2: 2 routes, P3: 1 legacy backup + 1 lib helper) · **Lines**: +991/-531 · **Time**: ~12 min ### Cross-file impact analysis - `_legacy/site-finder-page-tabs.tsx` — verified byte-identical to current `main:frontend/src/app/site-finder/page.tsx` (blob hash `568b146f0365336b726f394918e49af1d24e961e` matches on both sides). Backup is faithful, zero data loss. - All imports inside legacy backup resolve against current tree (`CadInput`, `FetchingState`, `KpiCard`, `OverviewTab`, `EnvironmentTab`, `LandTab`, `MarketTab`, `WeightProfilePanel`, `useSiteAnalysis`, `useDebouncedValue`, `useConnectionPoints`, `useCustomPois`, `POI_DEFAULT_WEIGHTS`) — confirmed all 12 modules exist. - `_legacy/` is underscore-prefixed → Next.js app router correctly excludes from routing. No accidental route exposure. - New `analysis/[cad]` route — no current callers in tree (expected: future A4 will wire it). No broken links. - `package.json` / `package-lock.json` untouched — zero new deps confirmed. ### Correctness highlights - React 19 `use(params)` for `Promise<{cad: string}>` — correct Next 15 idiom - Anchor IDs `section-1`..`section-5` literal & stable (no `index` keys, no dynamic IDs) - Mock toggle: strict `=== "true"` equality prevents string `"false"` evaluating truthy - All five `MOCK_*` per-endpoint flags initially derive from `USE_MOCKS` — proper staged-rollout shape for B1–B6 - Both pages have `"use client"` directive - No `dangerouslySetInnerHTML`, no user-controlled `href`, no XSS surface - TS strict: `as const` on inline-style narrowing (`flexWrap: "wrap" as const`) — clean ### Vault cross-check - PR body references `code/patterns/SiteFinder_Frontend_Migration_Plan_May18.md §A1` — proper traceability ### Behavior at `/site-finder` after merge Header (← Главная · SiteFinder · карта участков) + dashed-border MapPlaceholder + sidebar with 3 placeholder cards. **Old tab-based analyze UI removed from live route — users lose CadInput entry & analyze flow until A2/A4 ship.** Confirmed intentional per PR body. Rollback path: `git mv _legacy/site-finder-page-tabs.tsx site-finder/page.tsx` restores prior behavior byte-for-byte. ### Notes (non-blocking) - All `MOCK_*` flags equal `USE_MOCKS` — no observable difference yet; pattern unlocks per-endpoint flips later. Fine. - `_legacy/` becomes dead code after Wave 3 section refactor — schedule removal in plan. ### Risk / reversibility - **Risk**: Low — shell-only, no logic, no schema, no API, no deps - **Reversibility**: Trivial revert via `git mv` - **Merge window**: anytime Merging as squash.
lekss361 merged commit 3aaaaba5f9 into main 2026-05-17 22:01:50 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lekss361/gendesign#340
No description provided.