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";
import { countryCodeMapping } from "@/lib/geo";
import { geoEqualEarth, geoPath } from "d3-geo";
import { geoEquirectangular, geoPath } from "d3-geo";
import { AnimatePresence, m } from "framer-motion";
import { useTranslations } from "next-intl";
import { useState } from "react";
@ -33,9 +33,10 @@ export function InteractiveMap({
.map((code) => countryCodeMapping[code])
.filter((code) => code !== undefined);
const projection = geoEqualEarth()
.scale(180)
.translate([width / 2, height / 2]);
const projection = geoEquirectangular()
.scale(140)
.translate([width / 2, height / 2])
.rotate([-12, 0, 0]);
const path = geoPath().projection(projection);
@ -59,7 +60,7 @@ export function InteractiveMap({
feature.properties.iso_a3,
);
const countryCode = Object.entries(countryCodeMapping).find(
([,alpha3]) => alpha3 === feature.properties.iso_a3,
([, alpha3]) => alpha3 === feature.properties.iso_a3,
)?.[0];
const serverCount = countryCode
? serverCounts[countryCode] || 0
@ -71,7 +72,7 @@ export function InteractiveMap({
d={path(feature) || ""}
className={
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]"
}
onMouseEnter={() => {
@ -92,9 +93,9 @@ export function InteractiveMap({
<AnimatePresence mode="wait">
{tooltipData && (
<m.div
initial={{ opacity: 0, filter: "blur(10px)", scale: 0.8 }}
animate={{ opacity: 1, filter: "blur(0px)", scale: 1 }}
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"
initial={{ opacity: 0, filter: "blur(10px)" }}
animate={{ opacity: 1, filter: "blur(0px)" }}
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}
style={{
left: tooltipData.centroid[0],

View File

@ -182,7 +182,7 @@ export const NetworkChart = React.memo(function NetworkChart({
</div>
<div className="flex flex-wrap">{chartButtons}</div>
</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
config={chartConfig}
className="aspect-auto h-[250px] w-full"
@ -209,8 +209,7 @@ export const NetworkChart = React.memo(function NetworkChart({
<YAxis
tickLine={false}
axisLine={false}
mirror={true}
tickMargin={-15}
tickMargin={15}
minTickGap={20}
tickFormatter={(value) => `${value}ms`}
/>

View File

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