's'
This commit is contained in:
@@ -4,7 +4,7 @@ import { useState } from "react";
|
|||||||
import { Link, useLocale, useTranslation } from "@/i18n/navigation";
|
import { Link, useLocale, useTranslation } from "@/i18n/navigation";
|
||||||
import { cities } from "@/app/data/cities";
|
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() {
|
export default function HostMeetupPage() {
|
||||||
const { t } = useTranslation("hostMeetup");
|
const { t } = useTranslation("hostMeetup");
|
||||||
|
|||||||
@@ -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() {
|
export function useLocaleRouter() {
|
||||||
const locale = useLocale();
|
const locale = useLocale();
|
||||||
return {
|
return {
|
||||||
replace: (pathname: string, opts?: { locale?: Locale }) => {
|
push: (pathname: string, opts?: { locale?: Locale }) => navigate(pathname, locale, opts),
|
||||||
const newLocale = opts?.locale ?? locale;
|
replace: (pathname: string, opts?: { locale?: Locale }) => navigate(pathname, locale, opts),
|
||||||
const cleanPath = pathname.replace(/^\/(zh|en)/, "") || "/";
|
|
||||||
const newPath = `/${newLocale}${cleanPath === "/" ? "" : cleanPath}`;
|
|
||||||
window.location.href = newPath;
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
:root {
|
:root {
|
||||||
--background: #fafafa;
|
--background: #fafafa;
|
||||||
--foreground: #111827;
|
--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 {
|
.dark {
|
||||||
|
|||||||
@@ -1,19 +1,8 @@
|
|||||||
import type { Metadata, Viewport } from "next";
|
import type { Metadata, Viewport } from "next";
|
||||||
import { Geist, Geist_Mono } from "next/font/google";
|
|
||||||
import "./globals.css";
|
import "./globals.css";
|
||||||
import { ThemeProvider } from "./context/ThemeContext";
|
import { ThemeProvider } from "./context/ThemeContext";
|
||||||
import { getSiteConfig } from "@/config";
|
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 = {
|
export const viewport: Viewport = {
|
||||||
width: "device-width",
|
width: "device-width",
|
||||||
initialScale: 1,
|
initialScale: 1,
|
||||||
@@ -53,9 +42,7 @@ export default function RootLayout({
|
|||||||
}>) {
|
}>) {
|
||||||
return (
|
return (
|
||||||
<html lang="zh-CN" suppressHydrationWarning>
|
<html lang="zh-CN" suppressHydrationWarning>
|
||||||
<body
|
<body className="antialiased">
|
||||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
|
||||||
>
|
|
||||||
<ThemeScript />
|
<ThemeScript />
|
||||||
<ThemeProvider>{children}</ThemeProvider>
|
<ThemeProvider>{children}</ThemeProvider>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -99,8 +99,9 @@ export function MembersMap({
|
|||||||
chart.setOption(option);
|
chart.setOption(option);
|
||||||
setReady(true);
|
setReady(true);
|
||||||
|
|
||||||
chart.on("mouseover", (params: { data?: { id?: number } }) => {
|
chart.on("mouseover", (params: unknown) => {
|
||||||
const id = params.data?.id;
|
const p = params as { data?: { id?: number } };
|
||||||
|
const id = p.data?.id;
|
||||||
const city = id ? (data.find((c) => c.id === id) ?? null) : null;
|
const city = id ? (data.find((c) => c.id === id) ?? null) : null;
|
||||||
onCityHover?.(city);
|
onCityHover?.(city);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user