Skip to content

feat: add MobX-RESTful-Shadcn pagination, scroll-list, and editor demo pages with shared i18n nav#6

Open
Copilot wants to merge 16 commits into
mainfrom
copilot/nextjs-shadcn-add-mobx-restful-example
Open

feat: add MobX-RESTful-Shadcn pagination, scroll-list, and editor demo pages with shared i18n nav#6
Copilot wants to merge 16 commits into
mainfrom
copilot/nextjs-shadcn-add-mobx-restful-example

Conversation

Copilot AI commented Jun 24, 2026

Copy link
Copy Markdown

PR-6 PR-6 PR-6 Powered by Pull Request Badge

Implements MobX-RESTful-Shadcn demo pages in the App Router scaffold, and updates i18n/navigation wiring to follow the referenced GoodAction-Hub client+server context pattern.

New Pages

  • /[lang]/paginationRestTable with GitHub repos from idea2app org: paginated, searchable, with CRUD modals
  • /[lang]/scroll-listScrollList with infinite-scroll card grid of the same repos
  • /[lang]/editor — dynamic-loaded HTML editor demo migrated from upstream example

Shared Navigation & Language Switch

  • Added a shared MainNav component used across all app/[lang]/* pages
  • Added language switch dropdown in the shared nav
  • Updated app/[lang]/layout.tsx to render shared nav globally

i18n Runtime (Server + Client)

  • Added I18nProvider and wired SSR language/map into client context
  • Updated locale client pages to consume i18n from I18nContext at render time
  • Added/updated locale keys (including editor and language) in:
    • translation/en-US.ts
    • translation/zh-CN.ts
    • translation/zh-TW.ts

Component Installation

Shadcn UI registry components are installed via shadcn-helper (not committed manually under components/ui/), with required registry entries in components/index.ini, including:

  • @mobx-restful-shadcn/badge-bar
  • @mobx-restful-shadcn/rest-table
  • @mobx-restful-shadcn/scroll-list
  • @mobx-restful-shadcn/editor

Build Compatibility

  • Uses Babel TC39 decorators configuration (2023-05 style) for MobX decorator support
  • Uses next build --webpack for production build compatibility in this setup

Human changes

  1. [migrate] upgrade to Node.js 24, PNPM 11, ESLint 10, Globals 17, Lint-Staged 17, Shadcn-helper 0.5, Lucide-React 1 & other latest Upstream packages/actions
  2. [fix] Shadcn helper installation
  3. [remove] Geist for Next.js font

@TechQuery TechQuery added the feature New feature or request label Jun 24, 2026
Copilot AI changed the title [WIP] Add MobX-RESTful-Shadcn component example page feat: add MobX-RESTful-Shadcn pagination table and scroll-list example pages Jun 24, 2026
Copilot AI requested a review from TechQuery June 24, 2026 23:16

@TechQuery TechQuery left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot 仔细看组件库文档! https://github.com/idea2app/MobX-RESTful-Shadcn 要求全部使用 shadcn-helper 命令行安装所有 Shadcn UI 组件!components/ui/ 所有组件全删掉,全不要提交上来!

Comment thread models/Translation.ts Outdated
Comment thread pnpm-workspace.yaml
Comment thread tsconfig.json Outdated

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Author

@copilot 仔细看组件库文档! https://github.com/idea2app/MobX-RESTful-Shadcn 要求全部使用 shadcn-helper 命令行安装所有 Shadcn UI 组件!components/ui/ 所有组件全删掉�...

已删除全部 components/ui/ 文件(包括 editor/ 子目录),改为通过 shadcn-helper install 脚本在本地安装。相关 commit:refactor: remove manually-committed UI components, split translation files, add babel TC39 decorator config

Copilot AI requested a review from TechQuery June 25, 2026 17:25

@TechQuery TechQuery left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread app/[lang]/scroll-list/page.tsx Outdated
Comment thread translation/en-US.ts
Comment thread models/Translation.ts Outdated
Copilot AI requested a review from TechQuery June 25, 2026 17:48
…-Staged 17, Shadcn-helper 0.5, Lucide-React 1 & other latest Upstream packages/actions

[fix] Shadcn helper installation
[remove] Geist for Next.js font
@TechQuery TechQuery marked this pull request as ready for review June 25, 2026 21:47
Copilot AI review requested due to automatic review settings June 25, 2026 21:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two MobX-RESTful-Shadcn demo pages (pagination table + infinite scroll list) and migrates the app’s i18n implementation from static JSON dictionaries to a mobx-i18n-based translation store, alongside related build/tooling updates.

Changes:

  • Introduces /[lang]/pagination and /[lang]/scroll-list demo pages backed by a shared RepositoryModel("idea2app") store.
  • Replaces dictionaries/*.json + get-dictionary.ts + i18n-config.ts with a new translation/ module (SSR loader + translation maps).
  • Updates build/tooling configuration (Babel config, TS target/flags, pnpm workspace, CI action versions, font stack changes).

Reviewed changes

Copilot reviewed 26 out of 29 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tsconfig.json Updates TS target and class-fields behavior flag.
translation/en-US.ts Adds English translation map for new UI strings.
translation/zh-CN.ts Adds Simplified Chinese translation map for new UI strings.
translation/zh-TW.ts Adds Traditional Chinese translation map for new UI strings.
translation/index.ts Implements mobx-i18n store creation + SSR language selection helpers.
translation/context.ts Adds client-side React context for i18n store.
translation/server.ts Adds SSR loader that reads headers and returns an i18n store.
app/[lang]/page.tsx Switches home page to SSR i18n store + adds nav links to new demo pages.
app/[lang]/pagination/page.tsx Adds RestTable pagination demo page (client component).
app/[lang]/scroll-list/page.tsx Adds ScrollList infinite-scroll demo page (client component).
app/[lang]/layout.tsx Removes Next font setup; keeps minimal layout wrapper.
app/[lang]/globals.css Replaces Geist CSS variables with system font stacks.
models/Repository.ts Adds GitHub repository store and optional auth middleware.
proxy.ts Rewires locale detection to use new translation exports.
components.json Adds MobX-RESTful-Shadcn registry entry for shadcn-helper.
components/index.ini Lists MobX-RESTful-Shadcn components to install.
babel.config.js Adds custom Babel config for TS + decorators.
package.json Adds MobX-related deps and upgrades tooling; switches build to next build --webpack.
pnpm-workspace.yaml Adds pnpm workspace + build allowlist config.
.gitignore Ignores generated components/ui/ directory.
README.md Removes outdated next/font/Geist documentation references.
.github/workflows/main.yml Updates CI workflow triggers and action versions.
.github/workflows/init-template.yml Updates template init workflow action versions.
i18n-config.ts Removed old locale config constants/types.
get-dictionary.ts Removed old dictionary loader.
dictionaries/en-US.json Removed old JSON dictionary.
dictionaries/zh-CN.json Removed old JSON dictionary.
dictionaries/zh-TW.json Removed old JSON dictionary.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread babel.config.js
Comment on lines +2 to +25
presets: [
// https://babeljs.io/docs/babel-preset-react
[
'@babel/preset-react',
{
runtime: 'automatic',
development: process.env.BABEL_ENV === 'development',
},
],
],
plugins: [
// https://github.com/babel/babel/issues/16262#issuecomment-1962832499
[
'@babel/plugin-transform-typescript',
{
allowDeclareFields: true,
allowNamespaces: true,
allExtensions: true,
isTSX: true,
},
],
// https://babeljs.io/docs/babel-plugin-proposal-decorators#note-compatibility-with-babelplugin-transform-class-properties
['@babel/plugin-proposal-decorators', { version: '2023-05' }],
],
Comment thread app/[lang]/layout.tsx Outdated
Comment on lines 5 to 9
export default function RootLayout({ children }: PropsWithChildren<{}>) {
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
</body>
<body className="antialiased">{children}</body>
</html>
Comment thread app/[lang]/scroll-list/page.tsx Outdated
Comment on lines +12 to +13
<main className="container mx-auto px-4 py-8">
<h1 className="my-4 text-2xl font-bold">{i18n.t("load_more")}</h1>
Comment on lines +36 to +39
required: true,
minLength: 3,
invalidMessage: "Input 3 characters at least",
},
Comment thread models/Repository.ts
Comment on lines +3 to +7
githubClient.use(({ request }, next) => {
const token = process.env.GITHUB_TOKEN;

if (token)
request.headers = {
Comment thread app/[lang]/scroll-list/page.tsx
Comment thread app/[lang]/pagination/page.tsx
@TechQuery

Copy link
Copy Markdown
Member

Copilot AI commented Jun 25, 2026

Copy link
Copy Markdown
Author

@copilot 还漏移植了一个页面:https://github.com/idea2app/Lark-Next-Shadcn-ts/blob/2928a709b8ed3bea8a47514c37517760845b3209/pages/edtior.tsx

已补上移植页面并接入当前 App Router:新增 app/[lang]/editor/page.tsx,首页导航已加入入口,翻译键已补齐,components/index.ini 也加入了 @mobx-restful-shadcn/editor。对应提交:d9a5024(另含路径拼写修正提交 b082215)。

@TechQuery TechQuery left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot 仔细阅读参考代码的上下文后,认真修改。

Comment thread app/[lang]/page.tsx Outdated
Comment on lines +41 to +60
<nav className="flex flex-col gap-2 sm:flex-row sm:gap-4">
<Link
href={`/${lang}/pagination`}
className="hover:bg-accent hover:text-accent-foreground rounded-md border px-4 py-2 text-sm font-medium transition-colors"
>
{i18n.t("pagination") as string}
</Link>
<Link
href={`/${lang}/scroll-list`}
className="hover:bg-accent hover:text-accent-foreground rounded-md border px-4 py-2 text-sm font-medium transition-colors"
>
{i18n.t("scroll_list") as string}
</Link>
<Link
href={`/${lang}/editor`}
className="hover:bg-accent hover:text-accent-foreground rounded-md border px-4 py-2 text-sm font-medium transition-colors"
>
{i18n.t("editor") as string}
</Link>
</nav>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参考 https://github.com/GoodAction-Hub/GoodAction-Hub.github.io/blob/main/components%2FMainNav.tsx 将导航栏做成所有页面公用的组件,同时也要实现语言切换下拉框。

Comment thread translation/context.ts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

只复制粘贴文件没有用,那你得实际在客户端渲染的时候通过上下文使用国际化数据才行,参考:https://github.com/GoodAction-Hub/GoodAction-Hub.github.io/blob/main/app%2Flayout.tsx#L47-L50

Copilot AI commented Jun 27, 2026

Copy link
Copy Markdown
Author

@copilot 仔细阅读参考代码的上下文后,认真修改。

已按参考代码上下文完成重构:把导航抽成全局公用 MainNav(含语言切换下拉框),并在 [lang]/layout.tsx 中通过 I18nProvider 将 SSR 语言数据注入客户端上下文,分页/滚动列表/编辑器页面改为从 I18nContext 读取翻译。对应提交:d2c3a70

Copilot AI changed the title feat: add MobX-RESTful-Shadcn pagination table and scroll-list example pages feat: add MobX-RESTful-Shadcn pagination, scroll-list, and editor demo pages with shared i18n nav Jun 27, 2026
Copilot AI requested a review from TechQuery June 27, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants