From 1954e4fe6bc0a86d11e258a630978eeaedc834e9 Mon Sep 17 00:00:00 2001 From: bot-backend Date: Sat, 4 Jul 2026 11:43:47 +0300 Subject: [PATCH 1/2] =?UTF-8?q?fix(tradein/v2):=20=D1=81=D0=BC=D0=BE=D0=BD?= =?UTF-8?q?=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D1=84=D0=BE?= =?UTF-8?q?=D1=80=D0=BC=D1=83=20=D0=BB=D0=B8=D0=B4=D0=B0=20(#2377)=20?= =?UTF-8?q?=D0=B2=20=D0=B6=D0=B8=D0=B2=D0=BE=D0=B5=20v2-=D0=B4=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B2=D0=BE=20(#2395)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Форма из #2377 рендерилась только в недостижимом legacy HeroTransparency/ HeroSummary; /trade-in/v2 — единственный живой прод-роут. Новый v2-native LeadForm.tsx переиспользует useCreateLeadMutation as-is, портирует валидацию/state-machine из HeroTransparency (не JSX), монтируется после результата оценки (hasEstimate=true) вне scaled artboard. Refs #2395, #2377 --- tradein-mvp/frontend/src/app/v2/page.tsx | 9 + .../src/components/trade-in/v2/LeadForm.tsx | 343 ++++++++++++++++++ 2 files changed, 352 insertions(+) create mode 100644 tradein-mvp/frontend/src/components/trade-in/v2/LeadForm.tsx diff --git a/tradein-mvp/frontend/src/app/v2/page.tsx b/tradein-mvp/frontend/src/app/v2/page.tsx index 7b9160d5..8d3f4795 100644 --- a/tradein-mvp/frontend/src/app/v2/page.tsx +++ b/tradein-mvp/frontend/src/app/v2/page.tsx @@ -21,6 +21,7 @@ import HeroBar from "@/components/trade-in/v2/HeroBar"; import ParamsPanel from "@/components/trade-in/v2/ParamsPanel"; import ResultPanel from "@/components/trade-in/v2/ResultPanel"; import { ObjectSummary } from "@/components/trade-in/v2/ObjectSummary"; +import { LeadForm } from "@/components/trade-in/v2/LeadForm"; import { Footer } from "@/components/trade-in/v2/Footer"; import SectionOverlay from "@/components/trade-in/v2/SectionOverlay"; import { LocationDrawer } from "@/components/trade-in/v2/LocationDrawer"; @@ -928,6 +929,14 @@ export default function TradeInV2Page() { /> + + {/* Lead form (issue #2395 — v2-native mount of #2377's lead capture, + previously stranded in the dead HeroTransparency/HeroSummary tree). + Lives outside the scaled 1536×1024 artboard transform (in normal page + flow) so it stays legible at any viewport/scale instead of shrinking + with the HUD; only shown once a real, sufficient estimate is on + screen — never on the empty/insufficient-data states. */} + {hasEstimate && } ); } diff --git a/tradein-mvp/frontend/src/components/trade-in/v2/LeadForm.tsx b/tradein-mvp/frontend/src/components/trade-in/v2/LeadForm.tsx new file mode 100644 index 00000000..17e953d4 --- /dev/null +++ b/tradein-mvp/frontend/src/components/trade-in/v2/LeadForm.tsx @@ -0,0 +1,343 @@ +"use client"; + +// LeadForm — «Оставить заявку на трейд-ин» v2-native card (issue #2395: fixup +// of #2377 — the working lead form only existed in the dead HeroTransparency/ +// HeroSummary legacy tree, unreachable from the live `/trade-in/v2` route, +// which redirects everything else. This is the v2-native mount). +// +// Reused AS-IS (per #2395 DoD): `useCreateLeadMutation` (trade-in-api.ts) + +// `TradeInLeadInput`/`TradeInLeadResponse` types — backend is untouched and +// already live (`POST /api/v1/trade-in/lead`). The state machine / validation / +// submit-handler shape is ported from HeroTransparency.tsx (idle → submitting → +// success/error, phone regex mirroring the backend's `_PHONE_PATTERN`, explicit +// ФЗ-152 consent) — but the markup/styling below is a fresh v2 HUD card built on +// `tokens.ts`, not the legacy `.hero-lead*` CSS classes (those stay in +// trade-in.css, unused by this component). +// +// Critical fixup carried over from the #2377 code review: the submit + + + + + {phoneInvalid && ( +

+ Введите телефон (5–32 символа: цифры, +, пробелы, скобки, дефис) +

+ )} + {consentInvalid && ( +

+ Необходимо согласие на обработку персональных данных +

+ )} + {apiError && ( +

+ {apiError} +

+ )} +

+ Менеджер свяжется с вами для уточнения деталей трейд-ина +

+ + ); +} + +export default LeadForm; -- 2.45.3 From 6a8d588731d16723f36ea0d3fdbbbda5c7078027 Mon Sep 17 00:00:00 2001 From: bot-backend Date: Sat, 4 Jul 2026 11:44:17 +0300 Subject: [PATCH 2/2] =?UTF-8?q?fix(tradein/v2):=20review=20fixups=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20LeadForm=20(#2395)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit aria-disabled на submit-кнопке (сопровождает существующий visual opacity-дизейбл, screen-reader parity с disabled); убран неиспользуемый default export (page.tsx импортирует named, default export был dead code). --- tradein-mvp/frontend/src/components/trade-in/v2/LeadForm.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tradein-mvp/frontend/src/components/trade-in/v2/LeadForm.tsx b/tradein-mvp/frontend/src/components/trade-in/v2/LeadForm.tsx index 17e953d4..3aeb5484 100644 --- a/tradein-mvp/frontend/src/components/trade-in/v2/LeadForm.tsx +++ b/tradein-mvp/frontend/src/components/trade-in/v2/LeadForm.tsx @@ -264,6 +264,7 @@ export function LeadForm({ estimateId }: LeadFormProps) { type="submit" className="lf-submit-btn" disabled={leadMutation.isPending} + aria-disabled={canSubmit ? undefined : true} style={{ height: 36, flex: "0 0 auto", @@ -339,5 +340,3 @@ export function LeadForm({ estimateId }: LeadFormProps) { ); } - -export default LeadForm; -- 2.45.3