diff --git a/tradein-mvp/frontend/src/components/trade-in/HeroSummary.tsx b/tradein-mvp/frontend/src/components/trade-in/HeroSummary.tsx index 1a872eac..85ecf6d0 100644 --- a/tradein-mvp/frontend/src/components/trade-in/HeroSummary.tsx +++ b/tradein-mvp/frontend/src/components/trade-in/HeroSummary.tsx @@ -1,5 +1,7 @@ "use client"; +/* eslint-disable @next/next/no-img-element -- фото аналога с внешнего CDN, next/image не нужен */ + /** * HeroSummary — Секция 1 «Сводка» из mockup tradein.html. * Показывает медиану + достоверность CV + параметры объекта + 2 ценовых бара (объявления / сделки). @@ -49,6 +51,8 @@ export function HeroSummary({ estimate, input }: Props) { const m = estimate.median_price_rub; const lo = estimate.range_low_rub; const hi = estimate.range_high_rub; + // Фото первого аналога с картинкой — вместо пустого серого плейсхолдера. + const heroPhoto = estimate.analogs.find((a) => a.photo_url)?.photo_url ?? null; // Расчёт ширины для price bar (50% = середина): медиана внутри min/max const span = hi - lo; const medianPctRaw = span > 0 ? ((m - lo) / span) * 100 : 50; @@ -75,11 +79,23 @@ export function HeroSummary({ estimate, input }: Props) {
-
+
+ {heroPhoto && ( + Фото похожего объекта { + e.currentTarget.style.display = "none"; + }} + style={{ width: "100%", height: "100%", objectFit: "cover", display: "block" }} + /> + )}
- {estimate.sources_used.length > 0 - ? `${estimate.sources_used[0]} · ${estimate.n_analogs} аналогов` - : "Нет фото"} + {heroPhoto + ? `фото аналога${estimate.sources_used[0] ? ` · ${estimate.sources_used[0]}` : ""}` + : estimate.sources_used.length > 0 + ? `${estimate.sources_used[0]} · ${estimate.n_analogs} аналогов` + : "Нет фото"}
diff --git a/tradein-mvp/frontend/src/components/trade-in/SourcesProgress.tsx b/tradein-mvp/frontend/src/components/trade-in/SourcesProgress.tsx index 62290b0e..2529acca 100644 --- a/tradein-mvp/frontend/src/components/trade-in/SourcesProgress.tsx +++ b/tradein-mvp/frontend/src/components/trade-in/SourcesProgress.tsx @@ -186,7 +186,11 @@ export function SourcesProgress({ estimate, isPending }: Props) { {r.status === "done" && r.count === undefined && готово} {r.status === "loading" && "сбор..."} {r.status === "error" && "timeout — нет ответа"} - {r.status === "idle" && ожидает запрос} + {r.status === "idle" && ( + + {isDone ? "нет данных" : "ожидает запрос"} + + )}
))}