fix(tradein/v2): гейтить PDF-кнопку на hasEstimate (#2081 M4)
All checks were successful
CI Trade-In / changes (pull_request) Successful in 8s
CI / changes (pull_request) Successful in 8s
CI Trade-In / backend-tests (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI Trade-In / frontend-checks (pull_request) Successful in 58s

pdfHref вычислялся из currentEstimateId независимо от hasEstimate,
из-за чего кнопка "СКАЧАТЬ PDF-ОТЧЁТ" оставалась активной в двух
состояниях без валидного отчёта: insufficient-data (estimate_id есть,
но результат неполный) и restore-404 (UUID-подобный id в URL, которого
нет в БД). Остальные два контрола (ДЕЙСТВИТЕЛЕН ДО/КАК РАССЧИТАНО) уже
были гейтнуты на тот же hasEstimate — теперь все три используют один
источник истины.
This commit is contained in:
bot-backend 2026-07-04 01:13:18 +03:00
parent 308eeac214
commit 6531ee0923

View file

@ -81,7 +81,7 @@ export default function HeroBar({
hasEstimate,
onOpenInfo,
}: HeroBarProps) {
const pdfHref = pdfDownloadHref(estimateId);
const pdfHref = hasEstimate ? pdfDownloadHref(estimateId) : null;
// A downloadable report exists ⇔ the estimate is ready ⇒ the PDF button is the
// filled/primary CTA (M4). Otherwise it stays a disabled outline.
const pdfFilled = Boolean(pdfHref);