feat(tradein): «Что-если» interactive recompute on estimate result #686
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#686
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/tradein-what-if"
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?
«Что-если» — interactive recompute on the estimate result (web advantage over Brusnika's static PDF).
A compact panel above HeroSummary lets the agent/seller tweak the value-drivers — состояние ремонта (segmented), этаж (stepper+slider), площадь (±), балкон — and the estimate updates live. The agent can show «а если ремонт — вот +X».
Reuses the existing useEstimateMutation (same POST /trade-in/estimate, no parallel path). Recompute is debounced 700ms with skip-if-unchanged; «Авто-пересчёт» toggle + manual «Пересчитать» button to respect scraper/DaData cost. Baseline estimate kept for diffing → shows «+X млн ₽ (+Y%)» + «Сбросить»; result is local, never clobbers the page baseline/URL/downstream cards. Works for fresh and ?id= restored estimates.
Strict TS (tsc --noEmit clean), brand-token themed (re-skins under praktika), responsive.
Refs #657
???-???? interactive recompute panel. Reviewed via subagent (frontend 7-dim). Architecture clean: routes through useEstimateMutation -> same POST /estimate, ZERO client-side pricing duplication (delta computed from two server AggregatedEstimates). Debounce CORRECT: setTimeout+clearTimeout cleanup, lastSentKeyRef skip-if-unchanged prevents request-storm/infinite-loop, whatIfEstimate kept out of effect deps. Null-safety solid: headlinePrice null/<=0->median fallback, deltaPct basePrice>0 guarded (no div-by-zero). State reset correct (effect on initialDraft + ref re-sync). Floor type=range bounded; TS strict (no any/ts-ignore); rules-of-hooks OK; no setState-after-unmount (TanStack onSuccess). page.tsx gates panel with whatIfReady. NITS (non-blocking): recompute useCallback includes unstable mutation obj (harmless ? ref guard short-circuits, could use mutation.mutate); area input not client-clamped to 11..499 (backend 422 safety net). APPROVE.