Merge branch 'main' into cloudflare

This commit is contained in:
hamster1963 2024-11-25 22:17:28 +08:00
commit 269e2fcd13
3 changed files with 13 additions and 13 deletions

View File

@ -1,7 +1,7 @@
"use client"; "use client";
import { countryCodeMapping } from "@/lib/geo"; import { countryCodeMapping } from "@/lib/geo";
import { geoEqualEarth, geoPath } from "d3-geo"; import { geoEquirectangular, geoPath } from "d3-geo";
import { AnimatePresence, m } from "framer-motion"; import { AnimatePresence, m } from "framer-motion";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { useState } from "react"; import { useState } from "react";
@ -33,9 +33,10 @@ export function InteractiveMap({
.map((code) => countryCodeMapping[code]) .map((code) => countryCodeMapping[code])
.filter((code) => code !== undefined); .filter((code) => code !== undefined);
const projection = geoEqualEarth() const projection = geoEquirectangular()
.scale(180) .scale(140)
.translate([width / 2, height / 2]); .translate([width / 2, height / 2])
.rotate([-12, 0, 0]);
const path = geoPath().projection(projection); const path = geoPath().projection(projection);
@ -59,7 +60,7 @@ export function InteractiveMap({
feature.properties.iso_a3, feature.properties.iso_a3,
); );
const countryCode = Object.entries(countryCodeMapping).find( const countryCode = Object.entries(countryCodeMapping).find(
([,alpha3]) => alpha3 === feature.properties.iso_a3, ([, alpha3]) => alpha3 === feature.properties.iso_a3,
)?.[0]; )?.[0];
const serverCount = countryCode const serverCount = countryCode
? serverCounts[countryCode] || 0 ? serverCounts[countryCode] || 0
@ -71,7 +72,7 @@ export function InteractiveMap({
d={path(feature) || ""} d={path(feature) || ""}
className={ className={
isHighlighted isHighlighted
? "fill-orange-500 hover:fill-orange-400 stroke-orange-500 dark:stroke-amber-900 dark:fill-amber-900 dark:hover:fill-amber-800 transition-all cursor-pointer" ? "fill-orange-500 hover:fill-orange-300 stroke-orange-500 dark:stroke-amber-900 dark:fill-amber-900 dark:hover:fill-amber-700 transition-all cursor-pointer"
: "fill-neutral-200/50 dark:fill-neutral-800 stroke-neutral-300/40 dark:stroke-neutral-700 stroke-[0.5]" : "fill-neutral-200/50 dark:fill-neutral-800 stroke-neutral-300/40 dark:stroke-neutral-700 stroke-[0.5]"
} }
onMouseEnter={() => { onMouseEnter={() => {
@ -92,9 +93,9 @@ export function InteractiveMap({
<AnimatePresence mode="wait"> <AnimatePresence mode="wait">
{tooltipData && ( {tooltipData && (
<m.div <m.div
initial={{ opacity: 0, filter: "blur(10px)", scale: 0.8 }} initial={{ opacity: 0, filter: "blur(10px)" }}
animate={{ opacity: 1, filter: "blur(0px)", scale: 1 }} animate={{ opacity: 1, filter: "blur(0px)" }}
className="absolute pointer-events-none bg-white dark:bg-neutral-800 px-2 py-1 rounded shadow-lg text-sm dark:border dark:border-neutral-700" className="absolute hidden lg:block pointer-events-none bg-white dark:bg-neutral-800 px-2 py-1 rounded shadow-lg text-sm dark:border dark:border-neutral-700"
key={tooltipData.country} key={tooltipData.country}
style={{ style={{
left: tooltipData.centroid[0], left: tooltipData.centroid[0],

View File

@ -182,7 +182,7 @@ export const NetworkChart = React.memo(function NetworkChart({
</div> </div>
<div className="flex flex-wrap">{chartButtons}</div> <div className="flex flex-wrap">{chartButtons}</div>
</CardHeader> </CardHeader>
<CardContent className="px-2 sm:p-6"> <CardContent className="pr-2 pl-0 py-4 sm:pt-6 sm:pb-6 sm:pr-6 sm:pl-2">
<ChartContainer <ChartContainer
config={chartConfig} config={chartConfig}
className="aspect-auto h-[250px] w-full" className="aspect-auto h-[250px] w-full"
@ -209,8 +209,7 @@ export const NetworkChart = React.memo(function NetworkChart({
<YAxis <YAxis
tickLine={false} tickLine={false}
axisLine={false} axisLine={false}
mirror={true} tickMargin={15}
tickMargin={-15}
minTickGap={20} minTickGap={20}
tickFormatter={(value) => `${value}ms`} tickFormatter={(value) => `${value}ms`}
/> />

View File

@ -1,6 +1,6 @@
{ {
"name": "nezha-dash", "name": "nezha-dash",
"version": "1.5.0", "version": "1.5.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev -p 3040", "dev": "next dev -p 3040",