45 lines
1.4 KiB
TypeScript
45 lines
1.4 KiB
TypeScript
import type { ObjectCheckRow } from "@/types/analytics";
|
||
|
||
const CHECK_LABELS: Record<string, string> = {
|
||
no_problems: "Нет проблемных объектов",
|
||
docs: "Документы опубликованы",
|
||
timing: "Сроки соблюдены",
|
||
photos: "Актуальные фото",
|
||
bankruptcy: "Не банкрот",
|
||
declaration: "Декларация обновлена",
|
||
};
|
||
|
||
export function ObjectChecksBadges({ checks }: { checks: ObjectCheckRow[] }) {
|
||
if (checks.length === 0) {
|
||
return (
|
||
<p style={{ color: "#9ca3af", fontSize: 13 }}>
|
||
Данные проверок ещё не загружены.
|
||
</p>
|
||
);
|
||
}
|
||
|
||
return (
|
||
<div style={{ display: "flex", flexWrap: "wrap", gap: 8 }}>
|
||
{checks.map((c) => (
|
||
<div
|
||
key={c.check_type}
|
||
style={{
|
||
display: "flex",
|
||
alignItems: "center",
|
||
gap: 6,
|
||
padding: "6px 12px",
|
||
borderRadius: 20,
|
||
fontSize: 13,
|
||
fontWeight: 500,
|
||
background: c.passed ? "#dcfce7" : "#fee2e2",
|
||
color: c.passed ? "#065f46" : "#991b1b",
|
||
border: `1px solid ${c.passed ? "#bbf7d0" : "#fecaca"}`,
|
||
}}
|
||
>
|
||
<span style={{ fontSize: 15 }}>{c.passed ? "✓" : "✗"}</span>
|
||
{CHECK_LABELS[c.check_type] ?? c.check_type}
|
||
</div>
|
||
))}
|
||
</div>
|
||
);
|
||
}
|