Compare commits

...

7 Commits

Author SHA1 Message Date
hamster1963
c4196eec83 bump version to 2.5.0 2025-01-25 12:04:50 +08:00
hamster1963
f7b081fad4 refactor: update server fetch and config with minor optimizations 2025-01-25 12:00:16 +08:00
hamster1963
527bf45f43 feat: update LanguageSwitcher with LanguageIcon 2025-01-25 11:33:01 +08:00
hamster1963
9f6fa51c5a fix: remove unused script 2025-01-25 11:07:54 +08:00
hamster1963
4a3c88c681 perf: remove eslint deps 2025-01-25 11:06:58 +08:00
hamster1963
1b00cd7bf0 chore: deps 2025-01-25 11:03:17 +08:00
hamster1963
d7f9e378fe style: better network tooltip 2025-01-25 10:57:16 +08:00
7 changed files with 24 additions and 23 deletions

View File

@ -28,7 +28,7 @@ export async function GET(req: NextRequest) {
}
if (!getEnv("NEXT_PUBLIC_ShowIpInfo")) {
return NextResponse.json({ error: "NEXT_PUBLIC_ShowIpInfo is disable" }, { status: 400 })
return NextResponse.json({ error: "ip info is disabled" }, { status: 400 })
}
const { searchParams } = new URL(req.url)

BIN
bun.lockb

Binary file not shown.

View File

@ -10,7 +10,7 @@ import {
import { localeItems } from "@/i18n-metadata"
import { setUserLocale } from "@/i18n/locale"
import { cn } from "@/lib/utils"
import { CheckCircleIcon } from "@heroicons/react/20/solid"
import { CheckCircleIcon, LanguageIcon } from "@heroicons/react/20/solid"
import { useLocale } from "next-intl"
export function LanguageSwitcher() {
@ -29,7 +29,7 @@ export function LanguageSwitcher() {
size="sm"
className="rounded-full px-[9px] bg-white dark:bg-black cursor-pointer hover:bg-accent/50 dark:hover:bg-accent/50"
>
{localeItems.find((item) => item.code === locale)?.name}
<LanguageIcon className="size-4" />
<span className="sr-only">Change language</span>
</Button>
</DropdownMenuTrigger>

View File

@ -164,12 +164,19 @@ const ChartTooltipContent = React.forwardRef<
<div
ref={ref}
className={cn(
"grid min-w-[8rem] items-start gap-1.5 rounded-sm border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",
"grid min-w-[8rem] items-start overflow-hidden gap-1.5 rounded-sm border border-border/50 bg-stone-100 dark:bg-stone-900 text-xs shadow-xl",
className,
)}
>
{!nestLabel ? tooltipLabel : null}
<div className="grid gap-1.5">
{!nestLabel && (
<p className="px-2.5 pt-1 mx-auto -mb-1">{!nestLabel ? tooltipLabel : null}</p>
)}
<div
className={cn("grid gap-1.5 bg-white dark:bg-black px-2.5 py-1.5", {
"border-t-[1px]": !nestLabel,
})}
>
{payload.map((item, index) => {
const key = `${nameKey || item.name || item.dataKey || "value"}`
const itemConfig = getPayloadConfigFromPayload(config, item, key)

View File

@ -3,10 +3,10 @@
import type { NezhaAPI, ServerApi } from "@/app/types/nezha-api"
import type { MakeOptional } from "@/app/types/utils"
import getEnv from "@/lib/env-entry"
import { unstable_noStore as noStore } from "next/cache"
import { connection } from "next/server"
export async function GetNezhaData() {
noStore()
await connection()
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
if (!nezhaBaseUrl) {
@ -87,6 +87,8 @@ export async function GetNezhaData() {
}
export async function GetServerMonitor({ server_id }: { server_id: number }) {
await connection()
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
if (!nezhaBaseUrl) {
console.error("NezhaBaseUrl is not set")
@ -131,6 +133,8 @@ export async function GetServerIP({
}: {
server_id: number
}): Promise<string> {
await connection()
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
if (!nezhaBaseUrl) {
console.error("NezhaBaseUrl is not set")
@ -178,6 +182,7 @@ export async function GetServerIP({
}
export async function GetServerDetail({ server_id }: { server_id: number }) {
await connection()
let nezhaBaseUrl = getEnv("NezhaBaseUrl")
if (!nezhaBaseUrl) {
console.error("NezhaBaseUrl is not set")

View File

@ -1,7 +1,6 @@
import withPWAInit from "@ducanh2912/next-pwa"
import withBundleAnalyzer from "@next/bundle-analyzer"
import createNextIntlPlugin from "next-intl/plugin"
import { env } from "next-runtime-env"
const bundleAnalyzer = withBundleAnalyzer({
enabled: process.env.ANALYZE === "true",
@ -29,7 +28,6 @@ const nextConfig = {
},
},
output: "standalone",
poweredByHeader: false,
eslint: {
// Warning: This allows production builds to successfully complete even if
// your project has ESLint errors.

View File

@ -1,6 +1,6 @@
{
"name": "nezha-dash",
"version": "2.4.0",
"version": "2.5.0",
"private": true,
"scripts": {
"dev": "next dev -p 3040",
@ -10,9 +10,7 @@
"format": "biome format --write .",
"check": "biome check",
"check:fix": "biome check --fix",
"build": "next build && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/",
"build-dev": "next build",
"start-dev": "next start"
"build": "next build && cp -r .next/static .next/standalone/.next/ && cp -r public .next/standalone/"
},
"dependencies": {
"@ducanh2912/next-pwa": "^10.2.9",
@ -28,10 +26,8 @@
"@radix-ui/react-switch": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.7",
"@trivago/prettier-plugin-sort-imports": "^5.2.1",
"@turf/turf": "^7.2.0",
"@types/d3-geo": "^3.1.0",
"@types/luxon": "^3.4.2",
"@typescript-eslint/eslint-plugin": "^8.21.0",
"caniuse-lite": "^1.0.30001695",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
@ -39,7 +35,6 @@
"country-flag-icons": "^1.5.14",
"d3-geo": "^3.1.1",
"d3-selection": "^3.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"flag-icons": "^7.3.2",
"i18n-iso-countries": "^7.13.0",
"lucide-react": "^0.454.0",
@ -59,19 +54,15 @@
"sharp": "^0.33.5",
"swr": "^2.3.0",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"typescript-eslint": "^8.21.0"
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@next/bundle-analyzer": "^15.1.6",
"@tailwindcss/postcss": "^4.0.0",
"@types/node": "^22.10.9",
"@types/node": "^22.10.10",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"eslint-config-next": "^15.1.6",
"eslint-plugin-turbo": "^2.3.4",
"eslint-plugin-unused-imports": "^4.1.4",
"postcss": "^8.5.1",
"tailwindcss": "^4.0.0",
"typescript": "^5.7.3",