Files
openclaw-market/app/[locale]/layout.tsx
richarjiang e79d721615 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 类型声明
2026-03-13 14:46:23 +08:00

90 lines
2.5 KiB
TypeScript

import type { ReactNode } from "react";
import type { Metadata } from "next";
import { Inter, JetBrains_Mono } from "next/font/google";
import { notFound } from "next/navigation";
import { NextIntlClientProvider } from "next-intl";
import { getMessages, getTranslations } from "next-intl/server";
import { routing } from "@/i18n/routing";
import "../globals.css";
const inter = Inter({
subsets: ["latin"],
variable: "--font-inter",
});
const jetbrainsMono = JetBrains_Mono({
subsets: ["latin"],
variable: "--font-mono",
});
export function generateStaticParams() {
return routing.locales.map((locale) => ({ locale }));
}
export async function generateMetadata({
params,
}: {
params: Promise<{ locale: string }>;
}): Promise<Metadata> {
const { locale } = await params;
const t = await getTranslations({ locale, namespace: "metadata" });
return {
title: t("title"),
description: t("description"),
alternates: {
languages: Object.fromEntries(
routing.locales.map((l) => [l, `/${l}`])
),
},
other: {
"application/ld+json": JSON.stringify({
"@context": "https://schema.org",
"@type": "SoftwareApplication",
name: "openclaw-reporter",
applicationCategory: "DeveloperApplication",
operatingSystem: "macOS, Linux, Windows",
description:
"A Claude Code skill that lets you join the OpenClaw global heatmap. Sends anonymous heartbeats (platform + model only) and generic task summaries. Install via: clawhub install openclaw-reporter",
url: "https://kymr.top/",
installUrl: "https://clawhub.com/skills/openclaw-reporter",
offers: { "@type": "Offer", price: "0", priceCurrency: "USD" },
permissions:
"Network access to https://kymr.top/, write to ~/.openclaw/, binaries: curl, python3, uname",
}),
},
};
}
export default async function LocaleLayout({
children,
params,
}: {
children: ReactNode;
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
if (!routing.locales.includes(locale as "en" | "zh")) {
notFound();
}
const messages = await getMessages();
return (
<html lang={locale} className="dark">
<body
className={`${inter.variable} ${jetbrainsMono.variable} font-sans antialiased`}
style={{
backgroundColor: "var(--bg-primary)",
color: "var(--text-primary)",
}}
>
<NextIntlClientProvider messages={messages}>
{children}
</NextIntlClientProvider>
</body>
</html>
);
}