diff --git a/README.md b/README.md index e215bc4..c460ba7 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,78 @@ -This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). +# Nomadro -## Getting Started +中文数字游民操作系统官网([nomadro.com](https://nomadro.com))。 -First, run the development server: +基于 Next.js App Router,提供游民导航、地理套利、直播工具箱等入口聚合。 + +## 技术栈 + +- Next.js 16 / React 19 / TypeScript +- Tailwind CSS 4 +- pnpm +- 中文用户识别:[is-china-user](https://github.com/yArna/isChinaUser) + +## 本地开发 ```bash -npm run dev -# or -yarn dev -# or +pnpm install pnpm dev -# or -bun dev ``` -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +打开 [http://localhost:3000](http://localhost:3000)。 -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. +常用命令: -This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. +```bash +pnpm build # 生产构建 +pnpm start # 启动生产服务 +pnpm lint # 代码检查 +``` -## Learn More +## 多语言 -To learn more about Next.js, take a look at the following resources: +默认根据浏览器环境自动判断语言: -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. +- 识别为中文用户 → 显示中文文案 +- 非中文用户 → 显示英文文案 -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! +实现要点: -## Deploy on Vercel +| 文件 | 作用 | +| --- | --- | +| `components/locale-provider.tsx` | 调用 `isChinaUser()`,提供 locale 上下文 | +| `lib/i18n.ts` | 中英文案字典 | +| `components/language-switcher.tsx` | 语言下拉(默认隐藏) | -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. +### 彩蛋:手动切换语言 -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. +语言下拉默认不展示。在页面**右上角区域 2.5 秒内连点 5 次**后会出现下拉框,可手动切换中文 / English。 + +- 解锁状态保存在当前标签页的 `sessionStorage`(`nomadro-lang-unlock`) +- 仅在已解锁时,手动选择的语言会写入 `localStorage`(`nomadro-locale`)并优先生效 +- 关闭标签页后恢复:重新按中文用户识别自动选语言,下拉再次隐藏 + +## 项目结构(简要) + +``` +app/ # 页面(首页 / about / contact) +components/ # UI 与 locale 相关组件 +lib/data.ts # 入口卡片等业务数据 +lib/i18n.ts # 多语言文案 +deploy/ # 服务器部署脚本与说明 +``` + +## 部署 + +生产域名:`nomadro.com`(`www` 301 到主域)。 + +详细步骤见 [`deploy/README.md`](./deploy/README.md)。 + +日常更新(服务器已部署过): + +```bash +ssh root@ +cd /var/www/nomadro.com +bash deploy/deploy.sh +``` + +当前发布分支默认为 `test`。