feat: 用 react-map-gl + MapLibre 替换 react-simple-maps 实现 2D 地图

- 替换 react-simple-maps/d3-geo/topojson-client 为 react-map-gl + maplibre-gl
- 使用 CARTO dark-matter 免费暗色瓦片,自带国家/城市名标注
- 基于 locale 动态切换地图标注语言(name:zh / name_en)
- MapLibre 原生 heatmap + circle 双层渲染替代 SVG 热力图
- 提取 MapPopup 组件,配合 react-map-gl Popup 实现点击弹窗
- continent page 改为 dynamic import (ssr: false)
- dev 模式去掉 Turbopack 以兼容 maplibre-gl
- 删除 heatmap-layer.tsx 和 react-simple-maps 类型声明
This commit is contained in:
richarjiang
2026-03-13 14:46:23 +08:00
parent 9e30771180
commit e79d721615
23 changed files with 1215 additions and 494 deletions

View File

@@ -10,6 +10,7 @@ export async function GET(req: NextRequest) {
const limitParam = parseInt(searchParams.get("limit") ?? "50", 10);
const limit = Math.min(Math.max(1, limitParam), 200);
const region = searchParams.get("region");
const sort = searchParams.get("sort") ?? "activity";
const conditions = [];
if (region) {
@@ -22,7 +23,7 @@ export async function GET(req: NextRequest) {
.select()
.from(claws)
.where(whereClause)
.orderBy(desc(claws.lastHeartbeat))
.orderBy(sort === "newest" ? desc(claws.createdAt) : desc(claws.lastHeartbeat))
.limit(limit);
const totalResult = await db
@@ -57,6 +58,7 @@ export async function GET(req: NextRequest) {
city: claw.city,
country: claw.country,
isOnline: activeSet.has(claw.id),
createdAt: claw.createdAt,
lastTask,
};
})