mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
fix: lint
This commit is contained in:
parent
15086d054a
commit
6ba7747dd6
@ -1,12 +1,11 @@
|
||||
"use client"
|
||||
|
||||
import { TooltipProvider } from "@/app/(main)/ClientComponents/detail/TooltipContext"
|
||||
import GlobalInfo from "@/app/(main)/ClientComponents/main/GlobalInfo"
|
||||
import { InteractiveMap } from "@/app/(main)/ClientComponents/main/InteractiveMap"
|
||||
import { useServerData } from "@/app/lib/server-data-context"
|
||||
|
||||
import GlobalLoading from "../../../../components/loading/GlobalLoading"
|
||||
import { geoJsonString } from "../../../../lib/geo-json-string"
|
||||
import { TooltipProvider } from "../detail/TooltipContext"
|
||||
import GlobalInfo from "./GlobalInfo"
|
||||
import { InteractiveMap } from "./InteractiveMap"
|
||||
import GlobalLoading from "@/components/loading/GlobalLoading"
|
||||
import { geoJsonString } from "@/lib/geo-json-string"
|
||||
|
||||
export default function ServerGlobal() {
|
||||
const { data: nezhaServerList, error } = useServerData()
|
||||
|
@ -1,11 +1,10 @@
|
||||
"use client"
|
||||
|
||||
import { useTooltip } from "@/app/(main)/ClientComponents/detail/TooltipContext"
|
||||
import MapTooltip from "@/app/(main)/ClientComponents/main/MapTooltip"
|
||||
import { countryCoordinates } from "@/lib/geo-limit"
|
||||
import { geoEquirectangular, geoPath } from "d3-geo"
|
||||
|
||||
import { useTooltip } from "../detail/TooltipContext"
|
||||
import MapTooltip from "./MapTooltip"
|
||||
|
||||
interface InteractiveMapProps {
|
||||
countries: string[]
|
||||
serverCounts: { [key: string]: number }
|
||||
|
@ -1,10 +1,9 @@
|
||||
"use client"
|
||||
|
||||
import { useTooltip } from "@/app/(main)/ClientComponents/detail/TooltipContext"
|
||||
import { useTranslations } from "next-intl"
|
||||
import { memo } from "react"
|
||||
|
||||
import { useTooltip } from "../detail/TooltipContext"
|
||||
|
||||
const MapTooltip = memo(function MapTooltip() {
|
||||
const { tooltipData } = useTooltip()
|
||||
const t = useTranslations("Global")
|
||||
|
@ -4,6 +4,7 @@ import { useServerData } from "@/app/lib/server-data-context"
|
||||
import ServerCard from "@/components/ServerCard"
|
||||
import ServerCardInline from "@/components/ServerCardInline"
|
||||
import Switch from "@/components/Switch"
|
||||
import GlobalLoading from "@/components/loading/GlobalLoading"
|
||||
import { Loader } from "@/components/loading/Loader"
|
||||
import getEnv from "@/lib/env-entry"
|
||||
import { useFilter } from "@/lib/network-filter-context"
|
||||
@ -14,8 +15,6 @@ import { useTranslations } from "next-intl"
|
||||
import dynamic from "next/dynamic"
|
||||
import { useEffect, useRef, useState } from "react"
|
||||
|
||||
import GlobalLoading from "../../../../components/loading/GlobalLoading"
|
||||
|
||||
const ServerGlobal = dynamic(() => import("./Global"), {
|
||||
ssr: false,
|
||||
loading: () => <GlobalLoading />,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import ServerListClient from "./ClientComponents/main/ServerListClient"
|
||||
import ServerOverviewClient from "./ClientComponents/main/ServerOverviewClient"
|
||||
import ServerListClient from "@/app/(main)/ClientComponents/main/ServerListClient"
|
||||
import ServerOverviewClient from "@/app/(main)/ClientComponents/main/ServerOverviewClient"
|
||||
|
||||
export default async function Home() {
|
||||
return (
|
||||
|
@ -3,13 +3,12 @@
|
||||
import { NetworkChartClient } from "@/app/(main)/ClientComponents/detail/NetworkChart"
|
||||
import ServerDetailChartClient from "@/app/(main)/ClientComponents/detail/ServerDetailChartClient"
|
||||
import ServerDetailClient from "@/app/(main)/ClientComponents/detail/ServerDetailClient"
|
||||
import ServerIPInfo from "@/app/(main)/ClientComponents/detail/ServerIPInfo"
|
||||
import TabSwitch from "@/components/TabSwitch"
|
||||
import { Separator } from "@/components/ui/separator"
|
||||
import getEnv from "@/lib/env-entry"
|
||||
import { use, useState } from "react"
|
||||
|
||||
import ServerIPInfo from "../../ClientComponents/detail/ServerIPInfo"
|
||||
|
||||
export default function Page(props: { params: Promise<{ id: string }> }) {
|
||||
const params = use(props.params)
|
||||
const tabs = ["Detail", "Network"]
|
||||
|
@ -1,9 +1,8 @@
|
||||
import Footer from "@/app/(main)/footer"
|
||||
import Header from "@/app/(main)/header"
|
||||
import { useTranslations } from "next-intl"
|
||||
import Link from "next/link"
|
||||
|
||||
import Footer from "./(main)/footer"
|
||||
import Header from "./(main)/header"
|
||||
|
||||
export default function NotFoundPage() {
|
||||
const t = useTranslations("NotFoundPage")
|
||||
return (
|
||||
|
@ -1,69 +0,0 @@
|
||||
import { NezhaAPISafe } from "@/app/types/nezha-api"
|
||||
import { cn, formatBytes } from "@/lib/utils"
|
||||
import { useTranslations } from "next-intl"
|
||||
|
||||
export function ServerCardPopoverCard({
|
||||
className,
|
||||
title,
|
||||
content,
|
||||
children,
|
||||
}: {
|
||||
className?: string
|
||||
title: string
|
||||
content?: string
|
||||
children?: React.ReactNode
|
||||
}) {
|
||||
return (
|
||||
<div className={cn("mb-[6px] flex w-full flex-col", className)}>
|
||||
<div className="text-sm font-semibold">{title}</div>
|
||||
{children ? children : <div className="break-all text-xs font-medium">{content}</div>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function ServerCardPopover({
|
||||
host,
|
||||
status,
|
||||
}: {
|
||||
host: NezhaAPISafe["host"]
|
||||
status: NezhaAPISafe["status"]
|
||||
}) {
|
||||
const t = useTranslations("ServerCardPopover")
|
||||
return (
|
||||
<section className="max-w-[300px]">
|
||||
<ServerCardPopoverCard
|
||||
title={t("System")}
|
||||
content={`${host.Platform}-${host.PlatformVersion} [${host.Virtualization}: ${host.Arch}]`}
|
||||
/>
|
||||
<ServerCardPopoverCard
|
||||
title={t("CPU")}
|
||||
content={`${host.CPU.map((item) => item).join(", ")}`}
|
||||
/>
|
||||
<ServerCardPopoverCard
|
||||
title={t("Mem")}
|
||||
content={`${formatBytes(status.MemUsed)} / ${formatBytes(host.MemTotal)}`}
|
||||
/>
|
||||
<ServerCardPopoverCard
|
||||
title={t("STG")}
|
||||
content={`${formatBytes(status.DiskUsed)} / ${formatBytes(host.DiskTotal)}`}
|
||||
/>
|
||||
<ServerCardPopoverCard
|
||||
title={t("Swap")}
|
||||
content={`${formatBytes(status.SwapUsed)} / ${formatBytes(host.SwapTotal)}`}
|
||||
/>
|
||||
<ServerCardPopoverCard
|
||||
title={t("Network")}
|
||||
content={`${formatBytes(status.NetOutTransfer)} / ${formatBytes(status.NetInTransfer)}`}
|
||||
/>
|
||||
<ServerCardPopoverCard
|
||||
title={t("Load")}
|
||||
content={`${status.Load1.toFixed(2)} / ${status.Load5.toFixed(2)} / ${status.Load15.toFixed(2)}`}
|
||||
/>
|
||||
<ServerCardPopoverCard
|
||||
className="mb-0"
|
||||
title={t("Online")}
|
||||
content={`${(status.Uptime / 86400).toFixed(0)} Days`}
|
||||
/>
|
||||
</section>
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user