From c8670aede635f8b921f1eba00d619af67045c092 Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 24 Aug 2025 23:36:09 +0800 Subject: [PATCH] feat(ui): drive config path UI from getClaudeConfigStatus (show path + existence hint) and remove direct getClaudeCodeConfigPath usage --- src/App.tsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 3117fb0..b84296e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -10,7 +10,7 @@ function App() { const [providers, setProviders] = useState>({}); const [currentProviderId, setCurrentProviderId] = useState(""); const [isAddModalOpen, setIsAddModalOpen] = useState(false); - const [configPath, setConfigPath] = useState(""); + const [configStatus, setConfigStatus] = useState<{ exists: boolean; path: string } | null>(null); const [editingProviderId, setEditingProviderId] = useState( null ); @@ -56,7 +56,7 @@ function App() { // 加载供应商列表 useEffect(() => { loadProviders(); - loadConfigPath(); + loadConfigStatus(); }, []); // 清理定时器 @@ -80,9 +80,9 @@ function App() { } }; - const loadConfigPath = async () => { - const path = await window.electronAPI.getClaudeCodeConfigPath(); - setConfigPath(path); + const loadConfigStatus = async () => { + const status = await window.electronAPI.getClaudeConfigStatus(); + setConfigStatus({ exists: Boolean(status?.exists), path: String(status?.path || "") }); }; // 生成唯一ID @@ -199,9 +199,12 @@ function App() { /> - {configPath && ( + {configStatus && (
- 配置文件位置: {configPath} + + 配置文件位置: {configStatus.path} + {!configStatus.exists ? "(未创建,切换或保存时会自动创建)" : ""} +