feat(web): integrate neighborhood radar chart into listing detail page
Add NeighborhoodRadarChart to listing detail view, fetching scores from the analytics API based on the listing's district and city. Displays a 6-axis radar chart (education, healthcare, transport, shopping, environment, safety) with overall score and color-coded badges. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -132,6 +132,20 @@ export interface SearchListingsParams {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export interface NeighborhoodScoreResult {
|
||||
district: string;
|
||||
city: string;
|
||||
educationScore: number;
|
||||
healthcareScore: number;
|
||||
transportScore: number;
|
||||
shoppingScore: number;
|
||||
greeneryScore: number;
|
||||
safetyScore: number;
|
||||
totalScore: number;
|
||||
poiCounts: Record<string, number>;
|
||||
calculatedAt: string;
|
||||
}
|
||||
|
||||
// ─── API Functions ───────────────────────────────────────
|
||||
|
||||
const API_BASE_URL = process.env['NEXT_PUBLIC_API_URL'] || 'http://localhost:3001/api/v1';
|
||||
@@ -188,4 +202,9 @@ export const listingsApi = {
|
||||
|
||||
return res.json() as Promise<{ mediaId: string; url: string }>;
|
||||
},
|
||||
|
||||
getNeighborhoodScore: (district: string, city: string = 'Hồ Chí Minh') =>
|
||||
apiClient.get<NeighborhoodScoreResult>(
|
||||
`/analytics/neighborhoods/${encodeURIComponent(district)}/score?city=${encodeURIComponent(city)}`,
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user