feat(ui): drive config path UI from getClaudeConfigStatus (show path + existence hint) and remove direct getClaudeCodeConfigPath usage
This commit is contained in:
17
src/App.tsx
17
src/App.tsx
@@ -10,7 +10,7 @@ function App() {
|
|||||||
const [providers, setProviders] = useState<Record<string, Provider>>({});
|
const [providers, setProviders] = useState<Record<string, Provider>>({});
|
||||||
const [currentProviderId, setCurrentProviderId] = useState<string>("");
|
const [currentProviderId, setCurrentProviderId] = useState<string>("");
|
||||||
const [isAddModalOpen, setIsAddModalOpen] = useState(false);
|
const [isAddModalOpen, setIsAddModalOpen] = useState(false);
|
||||||
const [configPath, setConfigPath] = useState<string>("");
|
const [configStatus, setConfigStatus] = useState<{ exists: boolean; path: string } | null>(null);
|
||||||
const [editingProviderId, setEditingProviderId] = useState<string | null>(
|
const [editingProviderId, setEditingProviderId] = useState<string | null>(
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
@@ -56,7 +56,7 @@ function App() {
|
|||||||
// 加载供应商列表
|
// 加载供应商列表
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadProviders();
|
loadProviders();
|
||||||
loadConfigPath();
|
loadConfigStatus();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// 清理定时器
|
// 清理定时器
|
||||||
@@ -80,9 +80,9 @@ function App() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadConfigPath = async () => {
|
const loadConfigStatus = async () => {
|
||||||
const path = await window.electronAPI.getClaudeCodeConfigPath();
|
const status = await window.electronAPI.getClaudeConfigStatus();
|
||||||
setConfigPath(path);
|
setConfigStatus({ exists: Boolean(status?.exists), path: String(status?.path || "") });
|
||||||
};
|
};
|
||||||
|
|
||||||
// 生成唯一ID
|
// 生成唯一ID
|
||||||
@@ -199,9 +199,12 @@ function App() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{configPath && (
|
{configStatus && (
|
||||||
<div className="config-path">
|
<div className="config-path">
|
||||||
<span>配置文件位置: {configPath}</span>
|
<span>
|
||||||
|
配置文件位置: {configStatus.path}
|
||||||
|
{!configStatus.exists ? "(未创建,切换或保存时会自动创建)" : ""}
|
||||||
|
</span>
|
||||||
<button
|
<button
|
||||||
className="browse-btn"
|
className="browse-btn"
|
||||||
onClick={handleOpenConfigFolder}
|
onClick={handleOpenConfigFolder}
|
||||||
|
|||||||
Reference in New Issue
Block a user