"use client"; /** * ScanCard — generic dark cockpit card: title (+ optional badge), metric rows, * and a "Подробнее" button that opens the card's detail drawer. * * When `drawerKey` + `onOpen` are provided the button is ENABLED and opens the * matching drawer; without them it stays disabled (no drill-down wired). Each * row's value flows from a {value, isReal, caption} view-model: placeholder * fields are rendered muted with their caption so they never read as live data. */ import styles from "@/app/site-finder/analysis/[cad]/ptica/ptica.module.css"; import type { PticaScanCard } from "@/components/site-finder/ptica/ptica-adapt"; import type { DrawerKey } from "@/components/site-finder/ptica/drawers/drawer-keys"; interface Props { card: PticaScanCard; /** When set (with onOpen) the "Подробнее" button opens this drawer. */ drawerKey?: DrawerKey; onOpen?: (key: DrawerKey) => void; } export function ScanCard({ card, drawerKey, onOpen }: Props) { const { title, badge, rows, emptyState } = card; const canOpen = Boolean(drawerKey && onOpen); return (

{title} {badge && {badge}}

{emptyState ? (
{emptyState}
) : ( rows.map((row) => { // Status-row variant (prototype .status-row): dot + label + state. if (row.status) { const dotClass = row.status === "warn" ? styles.dotWarn : row.status === "bad" ? styles.dotBad : ""; const stateClass = row.status === "ok" ? styles.stateOk : styles.stateWarn; return (
{row.key} {row.field.value}
); } const placeholder = !row.field.isReal; return (
{row.key} {row.field.value}
); }) )}
); }