diff --git a/src/components/settings/ImportExportSection.tsx b/src/components/settings/ImportExportSection.tsx
index 8597fa4..ad70a6a 100644
--- a/src/components/settings/ImportExportSection.tsx
+++ b/src/components/settings/ImportExportSection.tsx
@@ -54,86 +54,63 @@ export function ImportExportSection({
- {/* Export Section */}
-
-
-
- 导出配置
-
-
-
-
- {/* Divider */}
-
-
- {/* Import Section */}
-
-
-
- 导入配置
-
-
-
+ {/* Import and Export Buttons Side by Side */}
+
+ {/* Import Button */}
+
-
- {selectedFile ? (
-
- ) : null}
+
+
+ )}
- {selectedFile ? (
-
-
- 📄 {selectedFileName}
-
-
- ) : (
-
-
- {t("settings.noFileSelected")}
-
-
- )}
+ {/* Export Button */}
+
+
+
{
- // 取消/直接关闭:恢复到初始设置(包括语言回滚)
- resetSettings();
- acknowledgeRestart();
- clearSelection();
- resetStatus();
- onOpenChange(false);
- }, [
- acknowledgeRestart,
- clearSelection,
- onOpenChange,
- resetSettings,
- resetStatus,
- ]);
-
const closeAfterSave = useCallback(() => {
// 保存成功后关闭:不再重置语言,避免需要“保存两次”才生效
acknowledgeRestart();
@@ -118,7 +103,7 @@ export function SettingsPage({
} catch (error) {
console.error("[SettingsPage] Failed to save settings", error);
}
- }, [closeDialog, saveSettings]);
+ }, [closeAfterSave, saveSettings]);
const handleRestartLater = useCallback(() => {
setShowRestartPrompt(false);
@@ -144,15 +129,13 @@ export function SettingsPage({
}, [closeAfterSave, t]);
// 通用设置即时保存(无需手动点击)
+ // 使用 autoSaveSettings 避免误触发系统 API(开机自启、Claude 插件等)
const handleAutoSave = useCallback(
async (updates: Partial) => {
if (!settings) return;
updateSettings(updates);
try {
- const result = await saveSettings(updates, { silent: true });
- if (result?.requiresRestart) {
- setShowRestartPrompt(true);
- }
+ await autoSaveSettings(updates);
} catch (error) {
console.error("[SettingsPage] Failed to autosave settings", error);
toast.error(
@@ -162,7 +145,7 @@ export function SettingsPage({
);
}
},
- [saveSettings, settings, t, updateSettings],
+ [autoSaveSettings, settings, t, updateSettings],
);
const isBusy = useMemo(() => isLoading && !settings, [isLoading, settings]);
@@ -206,7 +189,7 @@ export function SettingsPage({
) : null}
-
+
{settings ? (
<>
+
+
+
>
) : null}
@@ -241,28 +243,6 @@ export function SettingsPage({
-
- {activeTab === "advanced" ? (
-
-
-
- ) : null}
)}