) : data ? (
<>
{/* ── KPI row ── */}
{[
{ label: "Devices", value: data.devices.length, color: "text-white" },
{ label: "Flows", value: data.summary?.active_flows ?? data.flows.length, color: "text-white" },
{ label: "Download", value: fmtBytes(data.summary?.bandwidth_down ?? 0), color: "text-cyan-400" },
{ label: "Upload", value: fmtBytes(data.summary?.bandwidth_up ?? 0), color: "text-green-400" },
].map((kpi) => (
))}
{/* ── Security alert strip ── */}
{secCount > 0 && (
{/* DEVICES */}
{activeTab === "devices" && (
data.devices.length === 0 ?
: (
{data.devices.map((d, i) => {
const rc = riskStyle(d.risk_level);
return (
);
})}
)
)}
{/* FLOWS */}
{activeTab === "flows" && (
data.flows.length === 0 ?
: (
{data.flows.map((f, i) => (
| {f.src_ip || "—"} |
{f.dst_ip || "—"}{f.dst_port ? :{f.dst_port} : ""}
{f.dst_ip && }
|
{f.app_label || f.domain || "—"} |
{f.protocol || "—"} |
{fmtBytes(f.download)} |
{fmtBytes(f.upload)} |
{f.last_seen?.slice(0, 16) || "—"} |
))}
)
)}
{/* TOP APPS */}
{activeTab === "apps" && (
data.top_apps.length === 0 ?
: (
{data.top_apps.map((a, i) => {
const total = (a.download ?? 0) + (a.upload ?? 0);
const maxTotal = Math.max(...data.top_apps.map(x => (x.download ?? 0) + (x.upload ?? 0)), 1);
const pct = (total / maxTotal) * 100;
return (
{a.favicon
?

:
}
{a.app_label}
{a.category &&
{a.category}}
{fmtBytes(total)}
↓ {fmtBytes(a.download ?? 0)}
↑ {fmtBytes(a.upload ?? 0)}
);
})}
)
)}
{/* SECURITY */}
{activeTab === "security" && (
{/* Encryption Audit */}
Encryption Audit
{data.security?.encryption_audit.length ?? 0} devices
{(data.security?.encryption_audit.length ?? 0) === 0 ? : (
{data.security!.encryption_audit.map((r, i) => {
const rc = riskStyle(r.risk_level);
return (
| {r.ip_address || "—"} |
{r.device_label || "—"} |
|
{r.risk_level || "—"}
|
{fmtBytes(r.encrypted ?? 0)} |
{fmtBytes(r.unencrypted ?? 0)} |
);
})}
)}
{/* Insecure Protocols */}
Insecure Protocols
{data.security?.insecure_protocols.length ?? 0} records
{(data.security?.insecure_protocols.length ?? 0) === 0 ? : (
{data.security!.insecure_protocols.map((r, i) => {
const sc = severityStyle(r.risk);
return (
| {r.ip_address || "—"} |
{r.protocol || "—"} |
{r.risk || "—"}
|
{r.app_label || "—"} |
{r.dst_ip ? `${r.dst_ip}:${r.dst_port ?? "?"}` : "—"}
{r.dst_ip && }
|
{fmtBytes(r.download)} |
{fmtBytes(r.upload)} |
);
})}
)}
{/* Unencrypted Passwords */}
{(data.security?.unencrypted_passwords.length ?? 0) > 0 && (
Unencrypted Passwords Detected!
{data.security!.unencrypted_passwords.length} records
{data.security!.unencrypted_passwords.map((r, i) => {
const sc = severityStyle(r.severity);
return (
| {r.ip_address || "—"} |
{r.dst_ip ? `${r.dst_ip}:${r.dst_port ?? "?"}` : "—"}
{r.dst_ip && }
|
{r.protocol || "—"} |
{r.username || "—"} |
{r.severity || "—"}
|
);
})}
)}
{/* IP Reputation */}
{(data.security?.ip_reputation.length ?? 0) > 0 && (
IP Reputation
{data.security!.ip_reputation.length} records
{data.security!.ip_reputation.map((r, i) => (
| {r.ip_address || "—"} |
{r.local_ip || "—"} |
{r.reputation || "—"} |
{r.score ?? "—"} |
{r.country || "—"} |
{r.blacklisted
? ⛔ Yes
: ✓ No
}
|
))}
)}
{/* Tor & VPN side-by-side */}
{/* Tor */}
Tor Detections
{data.security?.tor_detections.length ?? 0}
{(data.security?.tor_detections.length ?? 0) === 0
?
: {data.security!.tor_detections.map((r, i) => (
{r.ip_address || "—"}
{r.country || "—"}
Exit: {r.exit_node || "—"}
))}
}
{/* VPN */}
VPN Detections
{data.security?.vpn_detections.length ?? 0}
{(data.security?.vpn_detections.length ?? 0) === 0
?
: {data.security!.vpn_detections.map((r, i) => (
{r.ip_address || "—"}
{r.vpn_type || "—"}
Remote: {r.remote_ip || "—"} • {r.country || "—"}
{r.remote_ip && }
{r.confidence &&
Confidence: {(r.confidence * 100).toFixed(0)}%
}
))}
}
{/* Server Discovery */}
{(data.server_discovery?.length ?? 0) > 0 && (
Servers Discovered
{data.server_discovery!.length} records
{data.server_discovery!.map((r, i) => (
|
{r.ip_address || "—"}
{r.ip_address && }
|
{r.hostname || "—"} |
{r.server_type || "—"} |
{r.port ?? "—"} |
{r.protocol || "—"} |
{r.os_label || "—"} |
))}
)}
)}
{/* EVENTS */}
{activeTab === "events" && (
data.events.length === 0 ?
: (
{data.events.map((ev, i) => {
const sc = severityStyle(ev.severity);
return (
{ev.severity || "—"}
{ev.event_type || "Unknown"}
{ev.ip_address || "—"}
{ev.mac_address && {ev.mac_address}}
{ev.description &&
{ev.description}
}
{ev.event_at?.slice(0, 16) || "—"}
);
})}
)
)}
{/* MAC BANDWIDTH */}
{activeTab === "mac" && (
data.mac_bandwidth.length === 0 ?
: (
{data.mac_bandwidth.map((m, i) => {
const maxTotal = Math.max(...data.mac_bandwidth.map(x => x.total ?? 0), 1);
const pct = ((m.total ?? 0) / maxTotal) * 100;
return (
{m.mac_address}
{m.manufacturer || "Unknown Manufacturer"}
{fmtBytes(m.total ?? 0)}
Total
↓ {fmtBytes(m.download ?? 0)}
↑ {fmtBytes(m.upload ?? 0)}
);
})}
)
)}