gendesign/tradein-mvp/frontend/src/components/trade-in/HouseAnalyticsSection.tsx
bot-backend 96de6d8e58
All checks were successful
Deploy Trade-In / changes (push) Successful in 4s
Deploy Trade-In / test (push) Has been skipped
Deploy Trade-In / build-backend (push) Has been skipped
Deploy Trade-In / deploy (push) Successful in 34s
Deploy Trade-In / build-frontend (push) Successful in 1m34s
fix(tradein-ui): eliminate mobile horizontal overflow on estimate result (#692) (#705)
Co-authored-by: bot-backend <bot-backend@gendsgn.local>
Co-committed-by: bot-backend <bot-backend@gendsgn.local>
2026-05-30 08:46:29 +00:00

47 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use client";
import { useEstimateHouseAnalytics, useEstimateSellTimeSensitivity } from "@/lib/trade-in-api";
import { PriceHistoryChart } from "./PriceHistoryChart";
import { HouseAnalyticsKpiRow } from "./HouseAnalyticsKpiRow";
import { RecentSoldList } from "./RecentSoldList";
import { SellTimeSensitivity } from "./SellTimeSensitivity";
type Props = { estimateId: string };
export function HouseAnalyticsSection({ estimateId }: Props) {
const { data, isPending, isError } = useEstimateHouseAnalytics(estimateId);
const sellTime = useEstimateSellTimeSensitivity(estimateId);
if (isPending || isError || !data) return null;
if (data.kpi.total_lots === 0) return null;
return (
<section style={{ marginTop: 16, minWidth: 0, maxWidth: "100%" }}>
<header
style={{
marginBottom: 12,
display: "flex",
justifyContent: "space-between",
alignItems: "baseline",
}}
>
<h3 style={{ margin: 0, fontSize: 16, fontWeight: 600 }}>
Аналитика дома
</h3>
<small style={{ color: "var(--muted, #6b7280)" }}>
{data.kpi.total_lots} объявлений
{data.radius_m > 0
? ` · в радиусе ${data.radius_m}м`
: " · в этом доме"}
</small>
</header>
<HouseAnalyticsKpiRow kpi={data.kpi} />
{sellTime.data && <SellTimeSensitivity data={sellTime.data} />}
{data.price_history.length >= 2 && (
<PriceHistoryChart points={data.price_history} />
)}
{data.recent_sold.length > 0 && (
<RecentSoldList items={data.recent_sold} />
)}
</section>
);
}