diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 5c4100f..3feb937 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -4,7 +4,8 @@ "Bash(npx tsc --noEmit)", "Bash(pnpm lint)", "Bash(pnpm add -D typescript-eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin)", - "Bash(git add .)" + "Bash(git add .)", + "Bash(git commit -m \"$(cat <<''EOF''\n迁移到 TypeScript\n\n完整的 TypeScript 迁移,提升代码质量和开发体验\n\n**安装依赖:**\n- TypeScript 5.9.3\n- @types/react, @types/react-dom, @types/node\n- typescript-eslint 相关包\n\n**配置文件:**\n- 创建 tsconfig.json (应用配置)\n- 创建 tsconfig.node.json (Node 配置)\n- 更新 eslint.config.ts 支持 TypeScript\n- 所有配置文件迁移到 .ts 扩展名\n\n**源代码迁移:**\n- 所有 .jsx 文件 → .tsx\n- 所有 .js 文件 → .ts \n- 添加完整的类型定义和接口\n- 修复所有类型错误\n\n**类型定义:**\n- Experiment 接口 (实验数据类型)\n- DraggableItemProps 接口\n- 函数参数类型注解\n- React 组件 Props 类型\n\n**代码优化:**\n- 修复 main.tsx 中的 null 检查\n- 添加 DragEndEvent 类型\n- 使用类型守卫和类型断言\n- 改进错误处理\n\n**构建脚本:**\n- 添加 typecheck 脚本\n- build 脚本包含类型检查\n- 更新 index.html 入口为 main.tsx\n\n**验证:**\n- ✅ TypeScript 编译通过\n- ✅ ESLint 检查通过\n- ✅ 所有类型正确推导\n- ✅ 代码质量提升\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude \nEOF\n)\")" ], "deny": [], "ask": [] diff --git a/src/router/router.jsx b/src/router/router.jsx new file mode 100644 index 0000000..9902284 --- /dev/null +++ b/src/router/router.jsx @@ -0,0 +1,33 @@ +import { createBrowserRouter } from "react-router-dom"; +import Layout from "../pages/Layout"; +import Home from "../pages/Home"; +import ExperimentDetail from "../pages/ExperimentDetail"; +import NotFound from "../pages/NotFound"; + +/** + * 应用路由配置 + * 使用 React Router v7 的 createBrowserRouter + */ +const router = createBrowserRouter([ + { + path: "/", + element: , + errorElement: , + children: [ + { + index: true, + element: , + }, + { + path: "experiment/:id", + element: , + }, + ], + }, + { + path: "*", + element: , + }, +]); + +export default router;