Merge pull request 'fix(tradein/ui): убрать debug cache-key, гейт тонких графиков, разграничить динамику цен' (#1821) from fix/tradein-estimate-ui-cleanup-v2 into main
All checks were successful
Deploy Trade-In / changes (push) Successful in 5s
Deploy Trade-In / test (push) Has been skipped
Deploy Trade-In / build-browser (push) Has been skipped
Deploy Trade-In / build-backend (push) Has been skipped
Deploy Trade-In / build-frontend (push) Successful in 1m39s
Deploy Trade-In / deploy (push) Successful in 44s

Reviewed-on: #1821
This commit is contained in:
lekss361 2026-06-20 06:55:03 +00:00
commit dae2b5a5d9
5 changed files with 140 additions and 125 deletions

View file

@ -25,6 +25,7 @@ interface Props {
}
const BIN_COUNT = 12;
const MIN_CHART_ANALOGS = 8;
const fmtK = (n: number) => `${Math.round(n / 1000)}k`;
interface Bin {
@ -74,7 +75,7 @@ export function DistributionCard({ estimate }: Props) {
return out;
}, [estimate.analogs, subject]);
// Empty state: меньше 3 валидных аналогов — распределение не показываем.
// Empty state: меньше 3 валидных аналогов — бины не строим вовсе.
if (bins.length === 0) return null;
const n = estimate.analogs.filter((l) => l.price_per_m2 > 0).length;
@ -94,6 +95,14 @@ export function DistributionCard({ estimate }: Props) {
</div>
</div>
{n < MIN_CHART_ANALOGS ? (
<div className="card-body">
<p style={{ color: "var(--muted)", textAlign: "center", padding: "24px 0" }}>
Мало аналогов для графика нужно не менее {MIN_CHART_ANALOGS}.
</p>
</div>
) : (
<>
{/* #835: декоративный чарт — aria-hidden (данные в тексте/легенде карточки). */}
<div aria-hidden="true" style={{ width: "100%", height: 260, padding: "12px 8px 0" }}>
<ResponsiveContainer>
@ -151,6 +160,8 @@ export function DistributionCard({ estimate }: Props) {
оранжевый столбец ваш диапазон
</span>
</div>
</>
)}
</article>
);
}

View file

@ -25,6 +25,7 @@ interface Props {
estimate: AggregatedEstimate;
}
const MIN_CHART_ANALOGS = 8;
const fmtM = (n: number) => `${(n / 1_000_000).toFixed(1)}`;
interface Point {
@ -72,6 +73,14 @@ export function ExposureCard({ estimate }: Props) {
</div>
</div>
{points.length < MIN_CHART_ANALOGS ? (
<div className="card-body">
<p style={{ color: "var(--muted)", textAlign: "center", padding: "24px 0" }}>
Недостаточно данных для графика нужно не менее {MIN_CHART_ANALOGS} аналогов со сроком.
</p>
</div>
) : (
<>
{/* #835: чарт декоративный (данные в заголовке/легенде/тексте карточки);
aria-hidden убирает recharts symbol'ы role="img" без accessible-name. */}
<div aria-hidden="true" style={{ width: "100%", height: 280, padding: "12px 8px 0" }}>
@ -130,6 +139,8 @@ export function ExposureCard({ estimate }: Props) {
<b style={{ color: "var(--fg)" }}>{fmtM(subjectPrice)} млн </b>
</span>
</div>
</>
)}
</article>
);
}

View file

@ -46,10 +46,10 @@ export function PriceHistoryChart({ points }: Props) {
<article className="card" style={{ marginTop: 12, padding: 16 }}>
<header style={{ marginBottom: 8 }}>
<h4 style={{ margin: 0, fontSize: 14, fontWeight: 600 }}>
Динамика цен в доме
История цен в этом доме
</h4>
<small style={{ color: "var(--muted, #6b7280)" }}>
Медиана /м² по году · Avito + Яндекс (по {totalLots} лотам)
Медиана /м² по годам · только этот дом · Avito + Яндекс ({totalLots} лотов)
</small>
</header>
{/* #835: декоративный чарт — aria-hidden (данные в тексте/легенде карточки). */}

View file

@ -58,8 +58,8 @@ export function PriceTrendCard({ estimate }: Props) {
<article className="card">
<div className="card-head">
<div>
<div className="section-kicker">Аналитика · Тренд</div>
<h2>Динамика /м²</h2>
<div className="section-kicker">Аналитика · Тренд рынка</div>
<h2>Динамика /м² по рынку района</h2>
</div>
<div className="card-meta">
<div>
@ -101,7 +101,7 @@ export function PriceTrendCard({ estimate }: Props) {
<div className="table-foot">
<span>
Медиана /м² по месяцам · {fmtMonth(data[0].month)} {" "}
Медиана /м² по аналогам рынка · {fmtMonth(data[0].month)} {" "}
{fmtMonth(data[data.length - 1].month)}
</span>
</div>

View file

@ -198,13 +198,6 @@ export function SourcesProgress({ estimate, isPending }: Props) {
</div>
<div className="card-foot">
<span className="mono" style={{ fontSize: 11, letterSpacing: "0.06em" }}>
CACHE-KEY ·{" "}
</span>
<span className="mono" style={{ fontSize: 11 }}>
{estimate?.estimate_id?.slice(0, 18) ?? "—"}
</span>{" "}
·{" "}
<span>при недоступности источника частичный результат не блокируется</span>
</div>
</article>