From 1e1737e82937ef1f938f8908aa7c2726edcbed7d Mon Sep 17 00:00:00 2001 From: lekss361 Date: Sun, 17 May 2026 16:33:22 +0300 Subject: [PATCH] =?UTF-8?q?fix(sf-12):=20MarketTrend=20=E2=80=94=20adaptiv?= =?UTF-8?q?e=20n<30/n<100=20confidence=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit n<30: hide trend block, show 'insufficient data — expand radius'. 30≤n<100: show trend + amber banner 'weak data (n=X) — expand radius'. n≥100: unchanged, no banner. --- .../site-finder/MarketTrendBlock.tsx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/frontend/src/components/site-finder/MarketTrendBlock.tsx b/frontend/src/components/site-finder/MarketTrendBlock.tsx index 9eaca405..1c744c08 100644 --- a/frontend/src/components/site-finder/MarketTrendBlock.tsx +++ b/frontend/src/components/site-finder/MarketTrendBlock.tsx @@ -13,6 +13,9 @@ const LABEL_COLORS: Record = { Падение: { bg: "#fecaca", color: "#b91c1c" }, }; +const N_WEAK = 30; +const N_STRONG = 100; + function trendArrow(delta: number): string { if (delta > 1) return "↑"; if (delta < -1) return "↓"; @@ -52,6 +55,31 @@ export function MarketTrendBlock({ trend }: Props) { ); } + const n = trend.recent_deals_count; + + // n < 30 — hide trend entirely, show data-insufficient state + if (n < N_WEAK) { + return ( +
+
+ Тренд рынка в радиусе {trend.radius_km} км +
+
+ Недостаточно данных (n={n}) — расширьте радиус для анализа тренда +
+
+ ); + } + const arrow = trendArrow(trend.delta_6m_pct); const arrowColor = deltaColor(trend.delta_6m_pct); const labelStyle = LABEL_COLORS[trend.label] ?? { @@ -132,6 +160,13 @@ export function MarketTrendBlock({ trend }: Props) { > {trend.label} + + {/* Weak data warning: 30 ≤ n < 100 */} + {n < N_STRONG && ( +
+ Слабые данные (n={n}) — расширьте радиус для точности +
+ )} ); } -- 2.45.3