fix(tradein): seed sales-vs-listings → StreetDealsCard рендерится (1:1) (#801)
StreetDealsCard фетчит /sales-vs-listings (не из estimate prop) → без засева queryKey возвращал null (секция «По вашей улице» отсутствовала). Добавлен FIXTURE_SALES (SalesVsListingsResponse, street+pairs) + seed ["trade-in","sales-vs-listings",address,area,rooms]. Теперь все 17 секций 1:1 с page.tsx (verified локально: 11 section-kicker'ов вкл. «По вашей улице»). Refs #801.
This commit is contained in:
parent
a34686ac38
commit
cbb3c64cd6
2 changed files with 67 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ import type {
|
||||||
HouseInfoForEstimate,
|
HouseInfoForEstimate,
|
||||||
IMVBenchmarkResponse,
|
IMVBenchmarkResponse,
|
||||||
PlacementHistoryItem,
|
PlacementHistoryItem,
|
||||||
|
SalesVsListingsResponse,
|
||||||
SellTimeSensitivityResponse,
|
SellTimeSensitivityResponse,
|
||||||
TradeInEstimateInput,
|
TradeInEstimateInput,
|
||||||
} from "@/types/trade-in";
|
} from "@/types/trade-in";
|
||||||
|
|
@ -356,3 +357,57 @@ export const FIXTURE_SELLTIME: SellTimeSensitivityResponse = {
|
||||||
{ price_premium_label: "plus10", price_premium_pct: 10, median_exposure_days: 270, p25_days: 150, p75_days: 360, n_lots: 6 },
|
{ price_premium_label: "plus10", price_premium_pct: 10, median_exposure_days: 270, p25_days: 150, p75_days: 360, n_lots: 6 },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Секция 12: StreetDealsCard — useSalesVsListings(address, area_m2, rooms).
|
||||||
|
// Guard: street != null И pairs.length > 0 — иначе return null.
|
||||||
|
export const FIXTURE_SALES: SalesVsListingsResponse = {
|
||||||
|
street: "Репина",
|
||||||
|
period_months: 24,
|
||||||
|
window_days: 180,
|
||||||
|
area_tolerance: 0.15,
|
||||||
|
total_deals: 9,
|
||||||
|
deals_with_listings: 5,
|
||||||
|
linkage_rate_pct: 55.6,
|
||||||
|
median_discount_pct: -6.2,
|
||||||
|
data_quality: "house_linked",
|
||||||
|
pairs: [
|
||||||
|
{
|
||||||
|
deal_id: 9001,
|
||||||
|
deal_date: "2026-04-18",
|
||||||
|
deal_price_rub: 8_900_000,
|
||||||
|
deal_price_per_m2: 161_818,
|
||||||
|
deal_area_m2: 55,
|
||||||
|
deal_rooms: 2,
|
||||||
|
deal_floor: 6,
|
||||||
|
deal_address: "Екатеринбург, ул. Репина, 75/2",
|
||||||
|
listing_id: 50001,
|
||||||
|
listing_source: "avito",
|
||||||
|
listing_source_url: "https://www.avito.ru/ekaterinburg/kvartiry/preview-d1",
|
||||||
|
listing_date: "2026-03-20",
|
||||||
|
listing_price_rub: 9_500_000,
|
||||||
|
listing_price_per_m2: 172_727,
|
||||||
|
listing_area_m2: 55,
|
||||||
|
days_listing_to_deal: 29,
|
||||||
|
discount_pct: -6.3,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
deal_id: 9002,
|
||||||
|
deal_date: "2026-02-27",
|
||||||
|
deal_price_rub: 9_100_000,
|
||||||
|
deal_price_per_m2: 159_649,
|
||||||
|
deal_area_m2: 57,
|
||||||
|
deal_rooms: 2,
|
||||||
|
deal_floor: 9,
|
||||||
|
deal_address: "Екатеринбург, ул. Репина, 73",
|
||||||
|
listing_id: 50002,
|
||||||
|
listing_source: "cian",
|
||||||
|
listing_source_url: "https://www.cian.ru/sale/flat/preview-d2",
|
||||||
|
listing_date: "2026-01-30",
|
||||||
|
listing_price_rub: 9_700_000,
|
||||||
|
listing_price_per_m2: 170_175,
|
||||||
|
listing_area_m2: 57,
|
||||||
|
days_listing_to_deal: 28,
|
||||||
|
discount_pct: -6.2,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -67,6 +67,7 @@ import {
|
||||||
FIXTURE_IMV,
|
FIXTURE_IMV,
|
||||||
FIXTURE_INPUT,
|
FIXTURE_INPUT,
|
||||||
FIXTURE_PLACEMENT,
|
FIXTURE_PLACEMENT,
|
||||||
|
FIXTURE_SALES,
|
||||||
FIXTURE_SELLTIME,
|
FIXTURE_SELLTIME,
|
||||||
} from "./fixture";
|
} from "./fixture";
|
||||||
|
|
||||||
|
|
@ -100,6 +101,17 @@ function PreviewContent() {
|
||||||
qc.setQueryData(["trade-in", "estimate", PREVIEW_ID, "sell-time-sensitivity"], FIXTURE_SELLTIME);
|
qc.setQueryData(["trade-in", "estimate", PREVIEW_ID, "sell-time-sensitivity"], FIXTURE_SELLTIME);
|
||||||
// Секция 10: ListingsCard — useEstimateCianPriceChanges (пустой = graceful)
|
// Секция 10: ListingsCard — useEstimateCianPriceChanges (пустой = graceful)
|
||||||
qc.setQueryData(["trade-in", "estimate", PREVIEW_ID, "cian-price-changes"], []);
|
qc.setQueryData(["trade-in", "estimate", PREVIEW_ID, "cian-price-changes"], []);
|
||||||
|
// Секция 12: StreetDealsCard — useSalesVsListings(address, area_m2, rooms)
|
||||||
|
qc.setQueryData(
|
||||||
|
[
|
||||||
|
"trade-in",
|
||||||
|
"sales-vs-listings",
|
||||||
|
FIXTURE_ESTIMATE.target_address,
|
||||||
|
FIXTURE_ESTIMATE.area_m2,
|
||||||
|
FIXTURE_ESTIMATE.rooms,
|
||||||
|
],
|
||||||
|
FIXTURE_SALES,
|
||||||
|
);
|
||||||
return qc;
|
return qc;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue