From 696bd4ac9cb760d2978072de7536174620c17fe5 Mon Sep 17 00:00:00 2001 From: TechQuery Date: Fri, 30 Oct 2026 02:17:43 +0800 Subject: [PATCH 1/2] [migrate] replace HTTP header with URL path in Language detection [optimize] upgrade to Node.js 26, PNPM 12, CN 0.5, React Markdown 10, Knip 6 & other latest Upstream packages/actions --- .github/workflows/Lark-notification.yml | 2 +- .github/workflows/deploy.yml | 4 +- app/{ => [language]}/activities/[id]/page.tsx | 12 +- app/{ => [language]}/activities/page.tsx | 12 +- app/{ => [language]}/home/page.tsx | 28 +- app/[language]/layout.tsx | 74 + app/{ => [language]}/origin/page.tsx | 13 +- app/[language]/page.tsx | 1 + app/{ => [language]}/recommend/page.tsx | 12 +- .../restaurants/[id]/page.tsx | 12 +- .../restaurants/page.module.css | 0 app/{ => [language]}/restaurants/page.tsx | 35 +- .../tutoring/[slug]/markdown.module.css | 0 app/{ => [language]}/tutoring/[slug]/page.tsx | 12 +- app/{ => [language]}/tutoring/page.tsx | 34 +- app/layout.tsx | 54 - app/page.tsx | 1 - components/Aggregation.tsx | 8 +- components/EventCard.tsx | 6 +- components/FilterBar.tsx | 26 +- components/MainNav.tsx | 20 +- components/SwitchLanguage.tsx | 10 +- i18n/routing.ts | 4 + i18n/server.ts | 13 +- next.config.ts | 39 +- package.json | 60 +- pnpm-lock.yaml | 5873 ++++++++++------- 27 files changed, 3850 insertions(+), 2515 deletions(-) rename app/{ => [language]}/activities/[id]/page.tsx (96%) rename app/{ => [language]}/activities/page.tsx (96%) rename app/{ => [language]}/home/page.tsx (85%) create mode 100644 app/[language]/layout.tsx rename app/{ => [language]}/origin/page.tsx (78%) create mode 100644 app/[language]/page.tsx rename app/{ => [language]}/recommend/page.tsx (92%) rename app/{ => [language]}/restaurants/[id]/page.tsx (94%) rename app/{ => [language]}/restaurants/page.module.css (100%) rename app/{ => [language]}/restaurants/page.tsx (92%) rename app/{ => [language]}/tutoring/[slug]/markdown.module.css (100%) rename app/{ => [language]}/tutoring/[slug]/page.tsx (95%) rename app/{ => [language]}/tutoring/page.tsx (90%) delete mode 100644 app/layout.tsx delete mode 100644 app/page.tsx create mode 100644 i18n/routing.ts diff --git a/.github/workflows/Lark-notification.yml b/.github/workflows/Lark-notification.yml index af3d023..affe55f 100644 --- a/.github/workflows/Lark-notification.yml +++ b/.github/workflows/Lark-notification.yml @@ -17,7 +17,7 @@ jobs: send-Lark-message: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 - uses: denoland/setup-deno@v2 with: diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a6585f4..bdac709 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -16,11 +16,11 @@ jobs: - uses: pnpm/action-setup@v6 with: - version: 11 + version: 12 - uses: actions/setup-node@v7 with: - node-version: 24 + node-version: 26 registry-url: https://registry.npmjs.org cache: pnpm diff --git a/app/activities/[id]/page.tsx b/app/[language]/activities/[id]/page.tsx similarity index 96% rename from app/activities/[id]/page.tsx rename to app/[language]/activities/[id]/page.tsx index 61b0d49..0d86c2d 100644 --- a/app/activities/[id]/page.tsx +++ b/app/[language]/activities/[id]/page.tsx @@ -11,7 +11,9 @@ import { DateTime } from 'luxon'; import Link from 'next/link'; import { notFound } from 'next/navigation'; -import { loadSSRI18nFromRequest } from '@/i18n/server'; +import { loadSSRI18n } from '@/i18n/server'; +import type { LanguageCode } from '@/i18n'; +import { localizedPath } from '@/i18n/routing'; import { ChinaMapWrapper } from '@/components/ChinaMapWrapper'; import { CommentBox } from '@/components/CommentBox'; import { TimelineItem } from '@/components/TimelineItem'; @@ -38,10 +40,10 @@ async function findActivity(id: string) { export default async function EventDetailPage({ params, }: { - params: Promise<{ id: string }>; + params: Promise<{ id: string; language: LanguageCode }>; }) { - const { id } = await params; - const { t } = await loadSSRI18nFromRequest(); + const { id, language } = await params; + const { t } = await loadSSRI18n(language); const found = await findActivity(id); if (!found) notFound(); @@ -82,7 +84,7 @@ export default async function EventDetailPage({
{/* Back + Edit buttons */}
- +