Files
MikrotikManager/components/network-map/access-mark.tsx
T
Denozordec 876a61f705
Docker images / prepare-release (push) Successful in 14s
Docker images / backend-test (push) Successful in 12m24s
Docker images / frontend-image (push) Successful in 2m21s
Docker images / updater-image (push) Successful in 41s
Docker images / netflow-agent-image (push) Successful in 32s
Docker images / backend-image (push) Successful in 1m52s
Docker images / publish-release (push) Successful in 17s
Docker images / notify-webhook (push) Successful in 2s
fix(network-map): перенести визуализацию карты из утверждённого прототипа
2026-12-03 11:36:21 +07:00

30 lines
1.9 KiB
TypeScript

"use client"
import { UsersIcon } from "lucide-react"
import { mapCardMeta, mapCardMetrics } from "@/lib/network-map-card-metrics"
export function MapAccessMark({ x, y, name, meta, selected, ariaLabel, onPick, width = 150 }: {
x: number; y: number; name: string; meta: string; selected: boolean; ariaLabel: string; onPick: () => void; width?: number
}) {
const kind = selected ? "user" : "access"
const { height, lines } = mapCardMetrics(name, kind, width)
const iconX = selected ? 19 : 15, nameX = selected ? 35 : 29
return <g transform={`translate(${x - width / 2},${y - height / 2})`} data-node-kind={kind}
role="button" aria-label={ariaLabel} tabIndex={0} className="network-map-focusable cursor-pointer"
onPointerDown={event => event.stopPropagation()}
onClick={event => { event.stopPropagation(); onPick() }}
onKeyDown={event => {
if (event.key === "Enter" || event.key === " ") { event.preventDefault(); event.stopPropagation(); onPick() }
}}>
<title>{[name, meta].filter(Boolean).join(" · ")}</title>
<rect className="network-map-focus-ring" x="-3" y="-3" width={width + 6} height={height + 6} rx="11" fill="none" stroke="var(--ring)" strokeWidth="2" />
<rect data-map-box="access" width={width} height={height} rx="9" fill="var(--card)" stroke={selected ? "var(--foreground)" : "var(--border)"} strokeWidth={selected ? 2 : 1.5} />
<circle cx={iconX} cy="21" r="12" fill="var(--muted)" />
<UsersIcon x={iconX - 8} y="13" width="16" height="16" color="var(--chart-2)" aria-hidden="true" />
{lines.map((line, i) => <text key={i} x={nameX} y={18 + i * 14} fill="var(--foreground)" fontSize="13" fontWeight="600">{line}</text>)}
<text x={nameX} y={33 + (lines.length - 1) * 14} fill="var(--muted-foreground)" fontFamily="var(--font-mono,Geist Mono,monospace)" fontSize="10.5">
{mapCardMeta(meta, width - nameX - 7)}
</text>
</g>
}