From fca3a9ab52bbe35e963427cb0ac541c8102a9808 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Fri, 21 Feb 2025 11:26:32 +0800 Subject: [PATCH] feat: add server ID and improve interactive map and tooltip functionality --- .../ClientComponents/main/InteractiveMap.tsx | 2 ++ app/(main)/ClientComponents/main/MapTooltip.tsx | 16 +++++++++++++--- .../ClientComponents/main/ServerListClient.tsx | 11 ++++++++++- app/context/tooltip-context.tsx | 1 + 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/(main)/ClientComponents/main/InteractiveMap.tsx b/app/(main)/ClientComponents/main/InteractiveMap.tsx index 34682b3..f2d3f36 100644 --- a/app/(main)/ClientComponents/main/InteractiveMap.tsx +++ b/app/(main)/ClientComponents/main/InteractiveMap.tsx @@ -82,6 +82,7 @@ export function InteractiveMap({ (server: any) => server.host.CountryCode?.toUpperCase() === countryCode, ) .map((server: any) => ({ + id: server.id, name: server.name, status: server.online_status, })) @@ -122,6 +123,7 @@ export function InteractiveMap({ const countryServers = nezhaServerList.result .filter((server: any) => server.host.CountryCode?.toUpperCase() === countryCode) .map((server: any) => ({ + id: server.id, name: server.name, status: server.online_status, })) diff --git a/app/(main)/ClientComponents/main/MapTooltip.tsx b/app/(main)/ClientComponents/main/MapTooltip.tsx index 492b519..1f6175f 100644 --- a/app/(main)/ClientComponents/main/MapTooltip.tsx +++ b/app/(main)/ClientComponents/main/MapTooltip.tsx @@ -2,6 +2,7 @@ import { useTooltip } from "@/app/context/tooltip-context" import { useTranslations } from "next-intl" +import Link from "next/link" import { memo } from "react" const MapTooltip = memo(function MapTooltip() { @@ -14,6 +15,10 @@ const MapTooltip = memo(function MapTooltip() { return a.status === b.status ? 0 : a.status ? 1 : -1 }) + const saveSession = () => { + sessionStorage.setItem("fromMainPage", "true") + } + return (
+
{tooltipData.count} {t("Servers")}