refactor(main): split main.ts into focused runtime modules (#123)

This commit is contained in:
2026-06-12 17:35:46 -07:00
committed by GitHub
parent 94a65416ae
commit 33e767458f
32 changed files with 3582 additions and 2003 deletions
+46
View File
@@ -0,0 +1,46 @@
import type { MessageBoxOptions, MessageBoxReturnValue } from 'electron';
type ShowMessageBox = (options: MessageBoxOptions) => Promise<MessageBoxReturnValue>;
export async function showLogExportSuccessDialog(options: {
zipPath: string;
showMessageBox: ShowMessageBox;
showItemInFolder: (path: string) => void;
logWarn: (message: string, details?: unknown) => void;
}): Promise<void> {
const successDialog = await options
.showMessageBox({
type: 'info',
title: 'SubMiner logs exported',
message: 'SubMiner log export created.',
detail: options.zipPath,
buttons: ['OK', 'Show in Folder'],
defaultId: 0,
cancelId: 0,
})
.catch((dialogError) => {
options.logWarn('Failed to show log export success dialog.', dialogError);
return undefined;
});
if (successDialog?.response === 1) {
options.showItemInFolder(options.zipPath);
}
}
export async function showLogExportErrorDialog(options: {
message: string;
showMessageBox: ShowMessageBox;
logWarn: (message: string, details?: unknown) => void;
}): Promise<void> {
await options
.showMessageBox({
type: 'error',
title: 'SubMiner log export failed',
message: 'Could not export SubMiner logs.',
detail: options.message,
})
.catch((dialogError) => {
options.logWarn('Failed to show log export error dialog.', dialogError);
});
}