fix(web): align PriceChangePct keys with API (d1/d7/d30)

API's market-snapshot returns priceChangePct with keys d1/d7/d30 but the
FE interface and KpiStrip accessor used day1/day7/day30, causing a
TypeError crash on the home page for authenticated users. Rename the
FE type, update KpiStrip accessors, and fix the landing test fixture.

Fixes TEC-3091.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-21 12:41:30 +07:00
parent ceab711dc6
commit 846ea652d8
3 changed files with 6 additions and 6 deletions

View File

@@ -84,7 +84,7 @@ vi.mock('@/lib/hooks/use-analytics', () => ({
activeCount: 1234,
avgPrice: 5_000_000_000,
medianPrice: 3_500_000_000,
priceChangePct: { day1: 0.1, day7: 1.5, day30: 3.2 },
priceChangePct: { d1: 0.1, d7: 1.5, d30: 3.2 },
avgPricePerM2: 85_000_000,
daysOnMarket: 28,
newListings24h: 15,

View File

@@ -139,7 +139,7 @@ function KpiStrip({ city }: { city: string }) {
<KpiCard
label="GGI HCM"
value={data ? formatPriceM2(data.avgPricePerM2) : '—'}
delta={data?.priceChangePct.day7}
delta={data?.priceChangePct.d7}
footnote="Chỉ số giá TB/m²"
icon={<BarChart3 className="h-3.5 w-3.5" />}
loading={isLoading}
@@ -147,7 +147,7 @@ function KpiStrip({ city }: { city: string }) {
<KpiCard
label="Giá TB"
value={data ? formatVnd(data.avgPrice) : '—'}
delta={data?.priceChangePct.day30}
delta={data?.priceChangePct.d30}
footnote="Toàn thành phố"
icon={<Building2 className="h-3.5 w-3.5" />}
loading={isLoading}

View File

@@ -139,9 +139,9 @@ export interface ProjectAiAdvice {
/* ------------------------------------------------------------------ */
export interface PriceChangePct {
day1: number;
day7: number;
day30: number;
d1: number;
d7: number;
d30: number;
}
export interface MarketSnapshotResponse {