UI: Improve soft reset dialog, and always confirm soft resets (#809)

This commit is contained in:
missymae#2783 2023-09-17 14:30:10 -06:00 committed by GitHub
parent b9d13063ac
commit e1d2e12747
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 12 deletions

@ -163,8 +163,7 @@ export function AugmentationsRoot(props: IProps): React.ReactElement {
<br />- home ram and cores <br />- home ram and cores
<br /> <br />
<br /> <br />
It is recommended to install several Augmentations at once. Preferably everything from any faction of It is recommended to install several Augmentations at once.
your choosing.
</> </>
} }
/> />

@ -3,7 +3,6 @@ import { Box, Button, List, ListItemButton, Paper, Tooltip, Typography } from "@
import { default as React, useRef, useState } from "react"; import { default as React, useRef, useState } from "react";
import { FileDiagnosticModal } from "../../Diagnostic/FileDiagnosticModal"; import { FileDiagnosticModal } from "../../Diagnostic/FileDiagnosticModal";
import { ImportData, saveObject } from "../../SaveObject"; import { ImportData, saveObject } from "../../SaveObject";
import { Settings } from "../../Settings/Settings";
import { StyleEditorButton } from "../../Themes/ui/StyleEditorButton"; import { StyleEditorButton } from "../../Themes/ui/StyleEditorButton";
import { ThemeEditorButton } from "../../Themes/ui/ThemeEditorButton"; import { ThemeEditorButton } from "../../Themes/ui/ThemeEditorButton";
import { ConfirmationModal } from "../../ui/React/ConfirmationModal"; import { ConfirmationModal } from "../../ui/React/ConfirmationModal";
@ -196,10 +195,7 @@ export const GameOptionsSidebar = (props: IProps): React.ReactElement => {
</Button> </Button>
</Tooltip> </Tooltip>
<Box sx={{ gridArea: "reset", "& .MuiButton-root": { height: "100%", width: "100%" } }}> <Box sx={{ gridArea: "reset", "& .MuiButton-root": { height: "100%", width: "100%" } }}>
<SoftResetButton <SoftResetButton onTriggered={props.softReset} />
noConfirmation={Settings.SuppressBuyAugmentationConfirmation}
onTriggered={props.softReset}
/>
</Box> </Box>
<Tooltip <Tooltip
title={ title={
@ -267,7 +263,8 @@ export const GameOptionsSidebar = (props: IProps): React.ReactElement => {
open={confirmResetOpen} open={confirmResetOpen}
onClose={() => setConfirmResetOpen(false)} onClose={() => setConfirmResetOpen(false)}
onConfirm={props.reactivateTutorial} onConfirm={props.reactivateTutorial}
confirmationText={"This will reset all your stats to 1 and money to 1k. Are you sure?"} confirmationText={"Reset your stats and money to start the tutorial? Home scripts will not be reset."}
additionalButton={<Button onClick={() => setConfirmResetOpen(false)}>Cancel</Button>}
/> />
</Box> </Box>
); );

@ -31,7 +31,7 @@ function travel(to: CityName): void {
Player.loseMoney(cost, "other"); Player.loseMoney(cost, "other");
Player.travel(to); Player.travel(to);
dialogBoxCreate(`You are now in ${to}!`); if (!Settings.SuppressTravelConfirmation) dialogBoxCreate(`You are now in ${to}!`);
Router.toPage(Page.City); Router.toPage(Page.City);
} }

@ -29,6 +29,7 @@ export function TravelConfirmationModal(props: IProps): React.ReactElement {
<Button onClick={travel}> <Button onClick={travel}>
<Typography>Travel</Typography> <Typography>Travel</Typography>
</Button> </Button>
<Button onClick={() => props.onClose()}>Cancel</Button>
</Modal> </Modal>
); );
} }

@ -34,6 +34,7 @@ export function DeleteGameButton({ color = "primary" }: IProps): React.ReactElem
open={modalOpened} open={modalOpened}
onClose={() => setModalOpened(false)} onClose={() => setModalOpened(false)}
confirmationText={"Really delete your game? (It's permanent!)"} confirmationText={"Really delete your game? (It's permanent!)"}
additionalButton={<Button onClick={() => setModalOpened(false)}>Cancel</Button>}
/> />
</> </>
); );

@ -2,7 +2,7 @@ import React, { useState } from "react";
import { ConfirmationModal } from "./ConfirmationModal"; import { ConfirmationModal } from "./ConfirmationModal";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import { Tooltip } from "@mui/material"; import { Tooltip, Typography } from "@mui/material";
import RestartAltIcon from "@mui/icons-material/RestartAlt"; import RestartAltIcon from "@mui/icons-material/RestartAlt";
interface IProps { interface IProps {
@ -26,9 +26,22 @@ export function SoftResetButton({
} }
} }
const confirmationMessage = `Soft Reset will:
- Reset basic stats and money
- Accumulate Favor for companies and factions
- Install Augmentations if you have any purchased
- Reset servers, programs, recent scripts and terminal
- Scripts on your home server will stop, but aren't deleted
- Stop some special mechanics like Bladeburner tasks
- You will not lose overall progress or access to special mechanics
Are you sure?
`;
return ( return (
<> <>
<Tooltip title="Perform a soft reset. Resets everything as if you had just installed Augmentations without installing them."> <Tooltip title="Perform a Soft Reset - similar to installing Augmentations, even if you have none.">
<Button startIcon={<RestartAltIcon />} color={color} onClick={handleButtonClick}> <Button startIcon={<RestartAltIcon />} color={color} onClick={handleButtonClick}>
Soft Reset Soft Reset
</Button> </Button>
@ -37,7 +50,8 @@ export function SoftResetButton({
onConfirm={onTriggered} onConfirm={onTriggered}
open={modalOpened} open={modalOpened}
onClose={() => setModalOpened(false)} onClose={() => setModalOpened(false)}
confirmationText={"This will perform the same action as installing Augmentations, are you sure?"} confirmationText={<Typography style={{ whiteSpace: "pre-wrap" }}>{confirmationMessage}</Typography>}
additionalButton={<Button onClick={() => setModalOpened(false)}>Cancel</Button>}
/> />
</> </>
); );