"use client"; import { AgentCard, AgentOverviewCard } from "@/components/AgentCard"; import { Header } from "@/components/Header"; import { UptimeMessage } from "@/services/types"; import { isAgentOnline } from "@/services/utils"; import { Box } from "lucide-react"; import { useEffect, useState } from "react"; export function HomePage() { const [agents, setAgents] = useState([]); useEffect(() => { fetch("http://localhost:3000/agents") .then((res) => res.json()) .then((data) => { setAgents(data); }); }, []); const totalAgents = agents.length; const onlineAgents = agents.filter((agent) => isAgentOnline(agent)).length; const offlineAgents = totalAgents - onlineAgents; return (

Overview

, color: "rgb(96, 165, 250)", bgColor: "rgba(59, 130, 246, 0.2)", }, }} /> ), color: "rgb(34, 197, 94)", bgColor: "rgba(34, 197, 94, 0.2)", }, }} /> ), color: "rgb(239, 68, 68)", bgColor: "rgba(239, 68, 68, 0.2)", }, }} />

Agents

{agents.map((agent, index) => ( ))}
); }