From 4d4c3f163959ca84403bb56b9ad3f44b58e96ad4 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Sun, 28 Dec 2025 15:01:27 +0800 Subject: [PATCH] fix: add server ID to tooltip data and update MapTooltip component for navigation --- src/components/GlobalMap.tsx | 2 ++ src/components/MapTooltip.tsx | 20 +++++++++++++++----- src/context/tooltip-context.ts | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/components/GlobalMap.tsx b/src/components/GlobalMap.tsx index ae9f2c1..b8e1abb 100644 --- a/src/components/GlobalMap.tsx +++ b/src/components/GlobalMap.tsx @@ -117,6 +117,7 @@ export function InteractiveMap({ countries, serverCounts, width, height, filtere const countryServers = nezhaServerList .filter((server: NezhaServer) => server.country_code?.toUpperCase() === countryCode) .map((server: NezhaServer) => ({ + id: server.id, name: server.name, status: formatNezhaInfo(now, server).online, })) @@ -155,6 +156,7 @@ export function InteractiveMap({ countries, serverCounts, width, height, filtere const countryServers = nezhaServerList .filter((server: NezhaServer) => server.country_code?.toUpperCase() === countryCode.toUpperCase()) .map((server: NezhaServer) => ({ + id: server.id, name: server.name, status: formatNezhaInfo(now, server).online, })) diff --git a/src/components/MapTooltip.tsx b/src/components/MapTooltip.tsx index c390f19..7078a4e 100644 --- a/src/components/MapTooltip.tsx +++ b/src/components/MapTooltip.tsx @@ -2,9 +2,11 @@ import useTooltip from "@/hooks/use-tooltip" import { AnimatePresence, m } from "framer-motion" import { memo } from "react" import { useTranslation } from "react-i18next" +import { useNavigate } from "react-router-dom" const MapTooltip = memo(function MapTooltip() { const { t } = useTranslation() + const navigate = useNavigate() const { tooltipData } = useTooltip() if (!tooltipData) return null @@ -28,7 +30,7 @@ const MapTooltip = memo(function MapTooltip() { >
{tooltipData.country === "China" ? "Mainland China" : tooltipData.country}
-+
{tooltipData.count} {t("map.Servers")}