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}) — расширьте радиус для точности +
+ )} ); }