- feat(mcp): unify notifications via onNotify in form and wizard

- refactor(mcp): remove HTML5 required to avoid native popups

- refactor(ui): propagate onNotify from App → McpPanel → McpFormModal → McpWizardModal

- feat(settings): use onNotify for export and file-selection feedback

- fix(ui): notify link-open failures via onNotify; remove unused appType prop from ProviderList

- chore: format codebase and ensure typecheck passes
This commit is contained in:
Jason
2025-10-10 20:52:16 +08:00
parent bfdf7d4ad5
commit e88562be98
10 changed files with 99 additions and 22 deletions

View File

@@ -24,11 +24,17 @@ import { isLinux } from "../lib/platform";
interface SettingsModalProps {
onClose: () => void;
onImportSuccess?: () => void | Promise<void>;
onNotify?: (
message: string,
type: "success" | "error",
duration?: number,
) => void;
}
export default function SettingsModal({
onClose,
onImportSuccess,
onNotify,
}: SettingsModalProps) {
const { t, i18n } = useTranslation();
@@ -387,11 +393,19 @@ export default function SettingsModal({
const result = await window.api.exportConfigToFile(filePath);
if (result.success) {
alert(`${t("settings.configExported")}\n${result.filePath}`);
onNotify?.(
`${t("settings.configExported")}\n${result.filePath}`,
"success",
4000,
);
}
} catch (error) {
console.error(t("settings.exportFailedError"), error);
alert(`${t("settings.exportFailed")}: ${error}`);
onNotify?.(
`${t("settings.exportFailed")}: ${String(error)}`,
"error",
5000,
);
}
};
@@ -406,7 +420,11 @@ export default function SettingsModal({
}
} catch (error) {
console.error(t("settings.selectFileFailed") + ":", error);
alert(`${t("settings.selectFileFailed")}: ${error}`);
onNotify?.(
`${t("settings.selectFileFailed")}: ${String(error)}`,
"error",
5000,
);
}
};