mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
53 lines
1.8 KiB
TypeScript
53 lines
1.8 KiB
TypeScript
"use client";
|
|
|
|
import { NetworkChartClient } from "@/app/(main)/ClientComponents/NetworkChart";
|
|
import ServerDetailChartClient from "@/app/(main)/ClientComponents/ServerDetailChartClient";
|
|
import ServerDetailClient from "@/app/(main)/ClientComponents/ServerDetailClient";
|
|
import TabSwitch from "@/components/TabSwitch";
|
|
import { Separator } from "@/components/ui/separator";
|
|
import GetIPInfo from "@/lib/GetIPInfo";
|
|
import { use, useEffect, useState } from "react";
|
|
|
|
export default function Page(props: { params: Promise<{ id: string }> }) {
|
|
const params = use(props.params);
|
|
const tabs = ["Detail", "Network"];
|
|
const [currentTab, setCurrentTab] = useState(tabs[0]);
|
|
|
|
useEffect(() => {
|
|
const updateViews = async () => {
|
|
const ipInfo = await GetIPInfo({ server_id: params.id });
|
|
console.log(ipInfo);
|
|
};
|
|
updateViews();
|
|
}, []);
|
|
|
|
return (
|
|
<div className="mx-auto grid w-full max-w-5xl gap-2">
|
|
<ServerDetailClient server_id={Number(params.id)} />
|
|
<section className="flex items-center my-2 w-full">
|
|
<Separator className="flex-1" />
|
|
<div className="flex justify-center w-full max-w-[200px]">
|
|
<TabSwitch
|
|
tabs={tabs}
|
|
currentTab={currentTab}
|
|
setCurrentTab={setCurrentTab}
|
|
/>
|
|
</div>
|
|
<Separator className="flex-1" />
|
|
</section>
|
|
<div style={{ display: currentTab === tabs[0] ? "block" : "none" }}>
|
|
<ServerDetailChartClient
|
|
server_id={Number(params.id)}
|
|
show={currentTab === tabs[0]}
|
|
/>
|
|
</div>
|
|
<div style={{ display: currentTab === tabs[1] ? "block" : "none" }}>
|
|
<NetworkChartClient
|
|
server_id={Number(params.id)}
|
|
show={currentTab === tabs[1]}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|