"use client" import { useState } from "react" import useSWR from "swr" import { PBSPanel } from "./pbs-panel" import { Security } from "./security" import { SystemLogs } from "./system-logs" import { TerminalPanel } from "./terminal-panel" import { ThemeToggle } from "./theme-toggle" import { Button } from "./ui/button" import { Card, CardContent } from "./ui/card" import { fetchApi } from "../lib/api-config" import { useT } from "../lib/i18n/provider" interface Vitals { hostname: string; cpu_usage: number; memory_usage: number; memory_used: number; memory_total: number; uptime: string } export function PBSDashboard() { const t = useT() const [tab, setTab] = useState("overview") const { data } = useSWR("/api/system", url => fetchApi(url), { refreshInterval: 10000 }) return

ProxMenux ยท PBS

{data?.hostname || t("pbs.loading")}

{tab === "overview" && <>
{[[t("pbs.cpu"), data ? `${data.cpu_usage.toFixed(1)}%` : "โ€”"], [t("pbs.memory"), data ? `${data.memory_used.toFixed(1)} / ${data.memory_total.toFixed(1)} GiB (${data.memory_usage.toFixed(1)}%)` : "โ€”"], [t("pbs.uptime"), data?.uptime || "โ€”"]].map(([label, value]) =>

{label}

{value}

)}
} {tab === "logs" && } {tab === "terminal" && } {tab === "security" && }
}