refactor: 抽取 Modal 组件、支持 JSON/CSV 导出、清理冗余代码

- 新增 Modal 组件,消除 3 个 Dialog 中重复的遮罩层/Escape/stopPropagation 代码
- PathEditDialog/HelpDialog/ImportDialog 改用 Modal 包裹
- handleExport 支持 JSON/CSV 两种格式(CSV 导出代码之前存在但从未接线)
- App.tsx 移除冗余的 initDarkMode 后重复设 store 的逻辑
- ErrorBoundary 添加 componentDidCatch 日志和 console.error

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-26 00:51:32 +08:00
parent b159407773
commit d28861ff9c
7 changed files with 94 additions and 175 deletions
+5
View File
@@ -7,9 +7,14 @@ export class ErrorBoundary extends Component<Props, State> {
state: State = { hasError: false, error: '' };
static getDerivedStateFromError(e: Error): State {
console.error('[ErrorBoundary]', e);
return { hasError: true, error: e.message };
}
componentDidCatch(_e: Error, info: React.ErrorInfo) {
console.error('[ErrorBoundary] componentStack:', info.componentStack);
}
render() {
if (this.state.hasError) {
return (