fix(site-finder): align VelocityBlock TS types with backend response shape
Per #147 bot review — cross-stack contract mismatch: Backend velocity.py (PR #146 merged) returns: obj_id, name, dev_name, obj_class, district_name, distance_m, total_sqm_period Frontend types had: obj_id, name, class, distance_m, total_sqm Result: c.class undefined → never showed class chip; c.total_sqm undefined → Math.round(NaN) = NaN, 'не число' в table column для всех 5 строк. ## Fix - VelocityCompetitor.class → obj_class - VelocityCompetitor.total_sqm → total_sqm_period - Added optional dev_name, district_name fields - Updated VelocityBlock.tsx — все 3 references (guard, chip render, table cell) Refs: #34, #147
This commit is contained in:
parent
33b6148cc5
commit
c6cabc1990
2 changed files with 7 additions and 5 deletions
|
|
@ -177,7 +177,7 @@ export function VelocityBlock({ velocity }: VelocityBlockProps) {
|
||||||
>
|
>
|
||||||
<td style={{ padding: "4px 8px" }}>
|
<td style={{ padding: "4px 8px" }}>
|
||||||
{c.name ?? `obj#${c.obj_id}`}
|
{c.name ?? `obj#${c.obj_id}`}
|
||||||
{c.class && (
|
{c.obj_class && (
|
||||||
<span
|
<span
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 6,
|
marginLeft: 6,
|
||||||
|
|
@ -185,7 +185,7 @@ export function VelocityBlock({ velocity }: VelocityBlockProps) {
|
||||||
color: "#9ca3af",
|
color: "#9ca3af",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{c.class}
|
{c.obj_class}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</td>
|
</td>
|
||||||
|
|
@ -205,7 +205,7 @@ export function VelocityBlock({ velocity }: VelocityBlockProps) {
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{Math.round(c.total_sqm).toLocaleString("ru")}
|
{Math.round(c.total_sqm_period).toLocaleString("ru")}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
|
|
|
||||||
|
|
@ -208,9 +208,11 @@ export interface Pipeline24mo {
|
||||||
export interface VelocityCompetitor {
|
export interface VelocityCompetitor {
|
||||||
obj_id: number;
|
obj_id: number;
|
||||||
name: string | null;
|
name: string | null;
|
||||||
class: string | null;
|
obj_class: string | null;
|
||||||
distance_m: number;
|
distance_m: number;
|
||||||
total_sqm: number;
|
total_sqm_period: number;
|
||||||
|
dev_name?: string | null;
|
||||||
|
district_name?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface VelocityPeriod {
|
export interface VelocityPeriod {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue