Add confirmation to installing

This commit is contained in:
Olivier Gagnon
2021-12-18 18:13:49 -05:00
parent 02605090df
commit 555216a39b
5 changed files with 64 additions and 14 deletions
+19 -8
View File
@@ -83,6 +83,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
const [diagnosticOpen, setDiagnosticOpen] = useState(false);
const [deleteGameOpen, setDeleteOpen] = useState(false);
const [themeEditorOpen, setThemeEditorOpen] = useState(false);
const [softResetOpen, setSoftResetOpen] = useState(false);
function handleExecTimeChange(event: any, newValue: number | number[]): void {
setExecTime(newValue as number);
@@ -210,6 +211,14 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
reader.readAsText(file);
}
function doSoftReset(): void {
if (!Settings.SuppressBuyAugmentationConfirmation) {
setSoftResetOpen(true);
} else {
props.softReset();
}
}
return (
<div className={classes.root} style={{ width: "90%" }}>
<Typography variant="h4" gutterBottom>
@@ -388,7 +397,7 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
</Typography>
}
>
<Typography>Suppress buy augmentation confirmation</Typography>
<Typography>Suppress augmentations confirmation</Typography>
</Tooltip>
}
/>
@@ -428,15 +437,11 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
)}
<ListItem>
<FormControlLabel
control={
<Switch checked={suppressSavedGameToast} onChange={handleSuppressSavedGameToastChange} />
}
control={<Switch checked={suppressSavedGameToast} onChange={handleSuppressSavedGameToastChange} />}
label={
<Tooltip
title={
<Typography>
If this is set, there will be no "Saved Game" toast appearing after save.
</Typography>
<Typography>If this is set, there will be no "Saved Game" toast appearing after save.</Typography>
}
>
<Typography>Suppress Saved Game Toast</Typography>
@@ -650,8 +655,14 @@ export function GameOptionsRoot(props: IProps): React.ReactElement {
</Typography>
}
>
<Button onClick={() => props.softReset()}>Soft Reset</Button>
<Button onClick={doSoftReset}>Soft Reset</Button>
</Tooltip>
<ConfirmationModal
open={softResetOpen}
onClose={() => setSoftResetOpen(false)}
onConfirm={props.softReset}
confirmationText={"This will perform the same action as installing Augmentations, are you sure?"}
/>
</Box>
<Box>
<Tooltip