ui fix
This commit is contained in:
44
AGENTS.md
44
AGENTS.md
@@ -53,12 +53,21 @@ src/
|
||||
│ ├── main.tsx # React 入口
|
||||
│ ├── App.tsx # 根组件
|
||||
│ ├── components/ # React 组件
|
||||
│ └── stores/ # Zustand Stores
|
||||
│ ├── stores/ # Zustand Stores
|
||||
│ └── locales/ # i18n 翻译文件
|
||||
└── tests/ # 测试配置
|
||||
├── setup.ts # 测试环境设置
|
||||
└── mocks/ # Mock 文件
|
||||
```
|
||||
|
||||
### 数据流
|
||||
|
||||
```
|
||||
Renderer (React) → Preload API → IPC → Main Process → Storage/Kintone API
|
||||
↓
|
||||
Result<T> 返回
|
||||
```
|
||||
|
||||
## 3. 路径别名
|
||||
|
||||
| 别名 | 路径 |
|
||||
@@ -123,6 +132,7 @@ type Result<T> = { success: true; data: T } | { success: false; error: string };
|
||||
|
||||
- IPC 调用使用 `invoke` 返回 `Result<T>`
|
||||
- Preload 通过 `contextBridge.exposeInMainWorld` 暴露 API
|
||||
- 所有 IPC handlers 集中在 `src/main/ipc-handlers.ts`
|
||||
|
||||
## 6. UI 组件规范
|
||||
|
||||
@@ -138,20 +148,27 @@ export const useStyles = createStyles(({ token, css }) => ({
|
||||
}));
|
||||
```
|
||||
|
||||
- 国际化:使用日文默认 `import jaJP from 'antd/locale/ja_JP'`
|
||||
- 禁止使用 Tailwind
|
||||
- **ESM Only**: LobeHub UI 仅支持 ESM
|
||||
|
||||
## 7. 安全规范
|
||||
## 7. 国际化 (i18n)
|
||||
|
||||
- 支持语言: `en-US`, `ja-JP`, `zh-CN`
|
||||
- 翻译文件位置: `src/renderer/src/locales/{locale}/{namespace}.json`
|
||||
- 使用 `react-i18next` 进行翻译
|
||||
- Ant Design 默认使用日文: `import jaJP from 'antd/locale/ja_JP'`
|
||||
|
||||
## 8. 安全规范
|
||||
|
||||
- 密码使用 `electron` 的 `safeStorage` 加密存储
|
||||
- WebPreferences 必须:`contextIsolation: true`, `nodeIntegration: false`, `sandbox: false`
|
||||
|
||||
## 8. 错误处理
|
||||
## 9. 错误处理
|
||||
|
||||
- 所有 IPC 返回 `Result<T>` 格式
|
||||
- 渲染进程检查 `result.success` 处理错误
|
||||
|
||||
## 9. fnm 环境配置
|
||||
## 10. fnm 环境配置
|
||||
|
||||
所有 npm/npx 命令需加载 fnm 环境:
|
||||
|
||||
@@ -163,20 +180,19 @@ export const useStyles = createStyles(({ token, css }) => ({
|
||||
eval "$(fnm env --use-on-cd)" && npm run dev
|
||||
```
|
||||
|
||||
## 10. 注意事项
|
||||
## 11. 技术栈约束
|
||||
|
||||
1. **ESM Only**: LobeHub UI 仅支持 ESM
|
||||
2. **React 19**: 使用 `@types/react@^19.0.0`
|
||||
3. **CSS 方案**: 使用 `antd-style`,禁止 Tailwind
|
||||
4. **禁止 `as any`**: 使用类型守卫或 `unknown`
|
||||
5. **函数组件优先**: 禁止 class 组件
|
||||
1. **React 19**: 使用 `@types/react@^19.0.0`
|
||||
2. **CSS 方案**: 使用 `antd-style`,禁止 Tailwind
|
||||
3. **禁止 `as any`**: 使用类型守卫或 `unknown`
|
||||
4. **函数组件优先**: 禁止 class 组件
|
||||
|
||||
## 11. 沟通规范
|
||||
## 12. 沟通规范
|
||||
|
||||
1. **人设**: 在回答的末尾加上「🦐」,用于确认上下文是否被正确保留
|
||||
2. **语言**: 使用中文进行回答
|
||||
|
||||
## 12. MVP Phase - Breaking Changes
|
||||
## 13. MVP Phase - Breaking Changes
|
||||
|
||||
**This is MVP phase - breaking changes are acceptable for better design.** However, you MUST:
|
||||
|
||||
@@ -202,7 +218,7 @@ eval "$(fnm env --use-on-cd)" && npm run dev
|
||||
4. If significant, ask user for confirmation before implementing
|
||||
5. Update related documentation after implementation
|
||||
|
||||
## 13. 测试规范
|
||||
## 14. 测试规范
|
||||
|
||||
### 测试框架
|
||||
|
||||
|
||||
Reference in New Issue
Block a user