-
-
Notifications
You must be signed in to change notification settings - Fork 407
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI/UX] Replace native dialogs (#1891)
* replaced native uninstall dialog box with uninstall modal * refactoring into dialog handler to reduce boilerplate * refactor and rm showErrorBox and openMessageBox * refactor showMessageBox in backend into frontend modals, improved dialog handler * ButtonOptions interface, DialotType enum, generic showDialogBoxModalAuto fxn, refactor error dialog into message box modal, uninstall modal closes immediately on input * rename showErrorBoxModalAuto to showDialog, close messageBoxModal on button click, optimization for linux uninstall modal * updating arguments for showDialogBoxModalAuto backend and button options interface frontend * C:/Program Files/Git/src/ absolute import alias refactor * fix import * removing enum from common types so imports work * backend now can use absolute imports * updating tests * tests again * replace @@ with src folder names * max width on dialog modal * add back removed stuff * rename to showDialogBoxModalAuto
- Loading branch information
1 parent
bc79812
commit a03347e
Showing
48 changed files
with
847 additions
and
600 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const dialog = jest.requireActual('../dialog') | ||
|
||
dialog.showErrorBoxModalAuto = jest.fn() | ||
dialog.showDialogBoxModalAuto = jest.fn() | ||
|
||
module.exports = dialog | ||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,55 @@ | ||
import { LogPrefix, logWarning } from '../logger/logger' | ||
import { BrowserWindow, dialog } from 'electron' | ||
import { ButtonOptions, DialogType } from 'common/types' | ||
|
||
const { showErrorBox } = dialog | ||
const { showErrorBox, showMessageBox } = dialog | ||
|
||
function showErrorBoxModalAuto(props: { | ||
function showDialogBoxModalAuto(props: { | ||
event?: Electron.IpcMainInvokeEvent | ||
title: string | ||
error: string | ||
message: string | ||
type: DialogType | ||
buttons?: Array<ButtonOptions> | ||
}) { | ||
if (props.event) { | ||
props.event.sender.send('showErrorDialog', props.title, props.error) | ||
props.event.sender.send( | ||
'showDialog', | ||
props.title, | ||
props.message, | ||
props.type, | ||
props.buttons | ||
) | ||
} else { | ||
let window: BrowserWindow | null | ||
try { | ||
window = BrowserWindow.getFocusedWindow() | ||
if (!window) { | ||
window = BrowserWindow.getAllWindows()[0] | ||
} | ||
window.webContents.send('showErrorDialog', props.title, props.error) | ||
window.webContents.send( | ||
'showDialog', | ||
props.title, | ||
props.message, | ||
props.type, | ||
props.buttons | ||
) | ||
} catch (error) { | ||
logWarning(['showErrorBoxModalAuto:', error], { | ||
logWarning(['showDialogBoxModalAuto:', error], { | ||
prefix: LogPrefix.Backend | ||
}) | ||
showErrorBox(props.title, props.error) | ||
switch (props.type) { | ||
case 'ERROR': | ||
showErrorBox(props.title, props.message) | ||
break | ||
default: | ||
showMessageBox(BrowserWindow.getAllWindows()[0], { | ||
title: props.title, | ||
message: props.message | ||
}) | ||
break | ||
} | ||
} | ||
} | ||
} | ||
|
||
export { showErrorBoxModalAuto } | ||
export { showDialogBoxModalAuto } |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.