diff --git a/app/(main)/ClientComponents/ServerListClient.tsx b/app/(main)/ClientComponents/ServerListClient.tsx index ff5345c..d907280 100644 --- a/app/(main)/ClientComponents/ServerListClient.tsx +++ b/app/(main)/ClientComponents/ServerListClient.tsx @@ -82,12 +82,20 @@ export default function ServerListClient() { ? sortedServers : sortedServers.filter((server) => server.tag === tag); + const tagCountMap: Record = {}; + sortedServers.forEach((server) => { + if (server.tag) { + tagCountMap[server.tag] = (tagCountMap[server.tag] || 0) + 1; + } + }); + return ( <> {getEnv("NEXT_PUBLIC_ShowTag") === "true" && uniqueTags.length > 1 && ( )} diff --git a/bun.lockb b/bun.lockb index 12a5c84..5b87449 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components/Switch.tsx b/components/Switch.tsx index acd68c6..79d6cda 100644 --- a/components/Switch.tsx +++ b/components/Switch.tsx @@ -8,10 +8,12 @@ import React, { createRef, useEffect, useRef } from "react"; export default function Switch({ allTag, nowTag, + tagCountMap, onTagChange, }: { allTag: string[]; nowTag: string; + tagCountMap: Record; onTagChange: (tag: string) => void; }) { const scrollRef = useRef(null); @@ -84,9 +86,14 @@ export default function Switch({ /> )}
-

- {tag === "defaultTag" ? t("defaultTag") : tag} -

+
+ {tag === "defaultTag" ? t("defaultTag") : tag}{" "} + {tag !== "defaultTag" && ( +
+ {tagCountMap[tag]} +
+ )} +
))}