From 3cb64a6e7619c45ad519280653426db87c4756c5 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Thu, 24 Oct 2024 21:26:11 +0800 Subject: [PATCH] fix: defaultTag --- app/(main)/ClientComponents/ServerListClient.tsx | 2 +- components/Switch.tsx | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/(main)/ClientComponents/ServerListClient.tsx b/app/(main)/ClientComponents/ServerListClient.tsx index 6f71a69..ff5345c 100644 --- a/app/(main)/ClientComponents/ServerListClient.tsx +++ b/app/(main)/ClientComponents/ServerListClient.tsx @@ -12,7 +12,7 @@ import useSWR from "swr"; export default function ServerListClient() { const t = useTranslations("ServerListClient"); const containerRef = useRef(null); - const defaultTag = t("defaultTag"); + const defaultTag = "defaultTag"; const [tag, setTag] = useState(defaultTag); diff --git a/components/Switch.tsx b/components/Switch.tsx index 1a83a6c..e84a080 100644 --- a/components/Switch.tsx +++ b/components/Switch.tsx @@ -2,6 +2,7 @@ import { cn } from "@/lib/utils"; import { motion } from "framer-motion"; +import { useTranslations } from "next-intl"; import React, { createRef, useEffect, useRef, useState } from "react"; export default function Switch({ @@ -15,6 +16,7 @@ export default function Switch({ }) { const scrollRef = useRef(null); const tagRefs = useRef(allTag.map(() => createRef())); + const t = useTranslations("ServerListClient"); useEffect(() => { const savedTag = sessionStorage.getItem("selectedTag"); @@ -82,7 +84,9 @@ export default function Switch({ /> )}
-

{tag}

+

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

))}