fix: valuation page Vietnamese diacritics, correct API routes, update tests
- Add proper Vietnamese diacritics to all valuation components (form, results, history) and their test assertions - Fix valuation API client to use /analytics/valuation endpoint - Return empty history gracefully (no server endpoint yet) Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,17 +14,17 @@ interface ValuationHistoryProps {
|
||||
}
|
||||
|
||||
function formatPrice(num: number): string {
|
||||
if (num >= 1_000_000_000) return `${(num / 1_000_000_000).toFixed(2)} ty`;
|
||||
if (num >= 1_000_000) return `${(num / 1_000_000).toFixed(0)} trieu`;
|
||||
if (num >= 1_000_000_000) return `${(num / 1_000_000_000).toFixed(2)} tỷ`;
|
||||
if (num >= 1_000_000) return `${(num / 1_000_000).toFixed(0)} triệu`;
|
||||
return num.toLocaleString('vi-VN');
|
||||
}
|
||||
|
||||
const PROPERTY_TYPE_LABELS: Record<string, string> = {
|
||||
APARTMENT: 'Can ho',
|
||||
HOUSE: 'Nha rieng',
|
||||
VILLA: 'Biet thu',
|
||||
LAND: 'Dat nen',
|
||||
OFFICE: 'Van phong',
|
||||
APARTMENT: 'Căn hộ',
|
||||
HOUSE: 'Nhà riêng',
|
||||
VILLA: 'Biệt thự',
|
||||
LAND: 'Đất nền',
|
||||
OFFICE: 'Văn phòng',
|
||||
SHOPHOUSE: 'Shophouse',
|
||||
};
|
||||
|
||||
@@ -41,19 +41,19 @@ export function ValuationHistory({
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-lg">Lich su dinh gia</CardTitle>
|
||||
<CardTitle className="text-lg">Lịch sử định giá</CardTitle>
|
||||
<CardDescription>
|
||||
{total} lan dinh gia truoc do
|
||||
{total} lần định giá trước đó
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{isLoading ? (
|
||||
<div className="flex h-32 items-center justify-center text-muted-foreground">
|
||||
Dang tai...
|
||||
Đang tải...
|
||||
</div>
|
||||
) : items.length === 0 ? (
|
||||
<div className="flex h-32 items-center justify-center text-muted-foreground">
|
||||
Chua co lich su dinh gia
|
||||
Chưa có lịch sử định giá
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
@@ -70,7 +70,7 @@ export function ValuationHistory({
|
||||
{PROPERTY_TYPE_LABELS[item.propertyType] || item.propertyType}
|
||||
</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{item.district}, {item.city} · {item.area} m2
|
||||
{item.district}, {item.city} · {item.area} m²
|
||||
</p>
|
||||
</div>
|
||||
<div className="text-right">
|
||||
@@ -93,7 +93,7 @@ export function ValuationHistory({
|
||||
disabled={page <= 1}
|
||||
onClick={() => onPageChange(page - 1)}
|
||||
>
|
||||
Truoc
|
||||
Trước
|
||||
</Button>
|
||||
<span className="text-sm text-muted-foreground">
|
||||
Trang {page}/{totalPages}
|
||||
@@ -104,7 +104,7 @@ export function ValuationHistory({
|
||||
disabled={page >= totalPages}
|
||||
onClick={() => onPageChange(page + 1)}
|
||||
>
|
||||
Tiep
|
||||
Tiếp
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user