This commit is contained in:
eric
2026-03-11 23:17:16 -05:00
parent efe816915d
commit 51b88291ef
5 changed files with 16 additions and 23 deletions

View File

@@ -4,7 +4,7 @@ import { useState } from "react";
import { Link, useLocale, useTranslation } from "@/i18n/navigation";
import { cities } from "@/app/data/cities";
const CITY_OPTIONS = cities.map((c) => ({ value: c.name, label: `${c.emoji} ${c.name}` }));
const CITY_OPTIONS = cities.map((c) => ({ value: c.name, label: `${c.icon} ${c.name}` }));
export default function HostMeetupPage() {
const { t } = useTranslation("hostMeetup");

View File

@@ -85,15 +85,18 @@ export function useTranslation(namespace?: string) {
};
}
function navigate(pathname: string, locale: Locale, opts?: { locale?: Locale }) {
const newLocale = opts?.locale ?? locale;
const cleanPath = pathname.replace(/^\/(zh|en)/, "") || "/";
const newPath = `/${newLocale}${cleanPath === "/" ? "" : cleanPath}`;
window.location.href = newPath;
}
export function useLocaleRouter() {
const locale = useLocale();
return {
replace: (pathname: string, opts?: { locale?: Locale }) => {
const newLocale = opts?.locale ?? locale;
const cleanPath = pathname.replace(/^\/(zh|en)/, "") || "/";
const newPath = `/${newLocale}${cleanPath === "/" ? "" : cleanPath}`;
window.location.href = newPath;
},
push: (pathname: string, opts?: { locale?: Locale }) => navigate(pathname, locale, opts),
replace: (pathname: string, opts?: { locale?: Locale }) => navigate(pathname, locale, opts),
};
}

View File

@@ -5,6 +5,8 @@
:root {
--background: #fafafa;
--foreground: #111827;
--font-geist-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
--font-geist-mono: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Monaco, "Courier New", "PingFang SC", monospace;
}
.dark {

View File

@@ -1,19 +1,8 @@
import type { Metadata, Viewport } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { ThemeProvider } from "./context/ThemeContext";
import { getSiteConfig } from "@/config";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const viewport: Viewport = {
width: "device-width",
initialScale: 1,
@@ -53,9 +42,7 @@ export default function RootLayout({
}>) {
return (
<html lang="zh-CN" suppressHydrationWarning>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
<body className="antialiased">
<ThemeScript />
<ThemeProvider>{children}</ThemeProvider>
</body>

View File

@@ -99,8 +99,9 @@ export function MembersMap({
chart.setOption(option);
setReady(true);
chart.on("mouseover", (params: { data?: { id?: number } }) => {
const id = params.data?.id;
chart.on("mouseover", (params: unknown) => {
const p = params as { data?: { id?: number } };
const id = p.data?.id;
const city = id ? (data.find((c) => c.id === id) ?? null) : null;
onCityHover?.(city);
});