Files
gitlab-instance-0a899031_no…/README.md

79 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Nomadro
中文数字游民操作系统官网([nomadro.com](https://nomadro.com))。
基于 Next.js App Router,提供游民导航、地理套利、直播工具箱等入口聚合。
## 技术栈
- Next.js 16 / React 19 / TypeScript
- Tailwind CSS 4
- pnpm
- 中文用户识别:[is-china-user](https://github.com/yArna/isChinaUser)
## 本地开发
```bash
pnpm install
pnpm dev
```
打开 [http://localhost:3000](http://localhost:3000)。
常用命令:
```bash
pnpm build # 生产构建
pnpm start # 启动生产服务
pnpm lint # 代码检查
```
## 多语言
默认根据浏览器环境自动判断语言:
- 识别为中文用户 → 显示中文文案
- 非中文用户 → 显示英文文案
实现要点:
| 文件 | 作用 |
| --- | --- |
| `components/locale-provider.tsx` | 调用 `isChinaUser()`,提供 locale 上下文 |
| `lib/i18n.ts` | 中英文案字典 |
| `components/language-switcher.tsx` | 语言下拉(默认隐藏) |
### 彩蛋:手动切换语言
语言下拉默认不展示。在页面**右上角区域 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@<server>
cd /var/www/nomadro.com
bash deploy/deploy.sh
```
当前发布分支默认为 `test`。