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
+1 -5
View File
@@ -1,6 +1,6 @@
import { useEffect } from 'react';
import { useAppStore } from '@/store/app-store';
import { initDarkMode, useThemeStore } from '@/store/theme-store';
import { initDarkMode } from '@/store/theme-store';
import { AppShell } from '@/components/layout/AppShell';
import { ErrorBoundary } from '@/components/layout/ErrorBoundary';
@@ -9,10 +9,6 @@ export default function App() {
useEffect(() => {
initDarkMode();
const saved = localStorage.getItem('darkMode');
if (saved === '1') {
useThemeStore.setState({ isDark: true });
}
initialize();
}, [initialize]);