fix(revert): add NEXT_PUBLIC_ShowTagCount env

This commit is contained in:
hamster1963 2024-11-18 14:22:01 +08:00
parent 01a9be99bb
commit 5f710c311f
4 changed files with 12 additions and 9 deletions

View File

@ -13,4 +13,5 @@ NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png
NEXT_PUBLIC_CustomTitle=NezhaDash NEXT_PUBLIC_CustomTitle=NezhaDash
NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha. NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha.
NEXT_PUBLIC_DisableIndex=false NEXT_PUBLIC_DisableIndex=false
NEXT_PUBLIC_BASE_PATH=/dash NEXT_PUBLIC_BASE_PATH=/
NEXT_PUBLIC_ShowTagCount=false

View File

@ -1,5 +1,6 @@
"use client"; "use client";
import getEnv from "@/lib/env-entry";
import { cn } from "@/lib/utils"; import { cn } from "@/lib/utils";
import { m } from "framer-motion"; import { m } from "framer-motion";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
@ -88,7 +89,8 @@ export default function Switch({
<div className="relative z-20 flex items-center gap-1"> <div className="relative z-20 flex items-center gap-1">
<div className="whitespace-nowrap flex items-center gap-2"> <div className="whitespace-nowrap flex items-center gap-2">
{tag === "defaultTag" ? t("defaultTag") : tag}{" "} {tag === "defaultTag" ? t("defaultTag") : tag}{" "}
{tag !== "defaultTag" && ( {getEnv("NEXT_PUBLIC_ShowTagCount") === "true" &&
tag !== "defaultTag" && (
<div className="w-fit px-1.5 rounded-full bg-muted"> <div className="w-fit px-1.5 rounded-full bg-muted">
{tagCountMap[tag]} {tagCountMap[tag]}
</div> </div>

View File

@ -13,3 +13,4 @@ NEXT_PUBLIC_CustomLogo=https://nezha-cf.buycoffee.top/apple-touch-icon.png
NEXT_PUBLIC_CustomTitle=NezhaDash NEXT_PUBLIC_CustomTitle=NezhaDash
NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha. NEXT_PUBLIC_CustomDescription=NezhaDash is a dashboard for Nezha.
NEXT_PUBLIC_DisableIndex=false NEXT_PUBLIC_DisableIndex=false
NEXT_PUBLIC_ShowTagCount=false

View File

@ -3,7 +3,6 @@ import withBundleAnalyzer from "@next/bundle-analyzer";
import createNextIntlPlugin from "next-intl/plugin"; import createNextIntlPlugin from "next-intl/plugin";
import { env } from "next-runtime-env"; import { env } from "next-runtime-env";
const bundleAnalyzer = withBundleAnalyzer({ const bundleAnalyzer = withBundleAnalyzer({
enabled: process.env.ANALYZE === "true", enabled: process.env.ANALYZE === "true",
}); });