import type { Node } from "../types"; import { StatusBadge } from "./StatusBadge"; interface NodeCardProps { node: Node; onClick?: (node: Node) => void; } function formatUptime(secs: number | null): string { if (secs == null) return "--"; if (secs < 60) return `${secs}s`; if (secs < 3600) return `${Math.floor(secs / 60)}m`; if (secs < 86400) return `${Math.floor(secs / 3600)}h ${Math.floor((secs % 3600) / 60)}m`; return `${Math.floor(secs / 86400)}d ${Math.floor((secs % 86400) / 3600)}h`; } function formatLastSeen(iso: string): string { try { const d = new Date(iso); const diffMs = Date.now() - d.getTime(); if (diffMs < 60_000) return "just now"; if (diffMs < 3_600_000) return `${Math.floor(diffMs / 60_000)}m ago`; if (diffMs < 86_400_000) return `${Math.floor(diffMs / 3_600_000)}h ago`; return d.toLocaleDateString(); } catch { return "--"; } } export function NodeCard({ node, onClick }: NodeCardProps) { const isOnline = node.health === "online"; return (