"use client" import type { ReactNode } from "react" import Link from "next/link" import { Badge } from "@/components/reui/badge" import { IconTile } from "@/components/reui/icon-tile" import { StatusBadge } from "@/components/status-badge" import { Flag } from "@/components/flag" import type { InternetPathViewModel } from "@/lib/dashboard-internet-path" import type { ServerStatus } from "@/lib/data" import { cn } from "@/lib/utils" import { ArrowRightIcon, HomeIcon, RadioIcon, ServerIcon, GlobeIcon } from "lucide-react" function pathStateToServerStatus(state: InternetPathViewModel["pathState"]): ServerStatus { if (state === "healthy") return "online" if (state === "failover" || state === "degraded") return "degraded" return "offline" } function HopChip({ label, name, country, icon, iconClassName, }: { label: string name: string country?: string icon: ReactNode iconClassName?: string }) { return (

{label}

{country ? : null} {name}

) } /** * Compact live path strip (Frame-friendly). Canvas lives separately. * Preview: https://reui.io/preview/base/stats-12 * Docs: https://reui.io/docs/components/base/icon-tile */ export function InternetPathSummary({ model }: { model: InternetPathViewModel | null }) { if (!model) { return (

Недостаточно данных для пути. Добавьте home-router и проверьте{" "} карту сети .

) } const hop = model.currentHop ?? model.primaryHop const wanName = hop?.wan.name ?? model.activeWanUplink?.name ?? "WAN" const wanIsp = hop?.wan.isp ?? model.activeWanUplink?.isp ?? "—" const ping = hop?.wanJhMetrics.pingMs const dl = hop?.wanJhMetrics.dlMbps return (
{model.pathState === "failover" ? ( failover ) : null} {ping != null ? ( {ping} мс ) : null} {dl != null ? ( {Math.round(dl)} ↓ Мбит/с ) : null}
} iconClassName="text-success" />

{model.currentPath?.reason ?? model.primaryPath?.reason ?? "Текущий путь не определён"}

) }