mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-24 18:22:58 +02:00
Add information to the recovery page
Adds error & environment information to the recovery page when available. The info will be displayed when the error boundary catches an error only. Otherwise, does a few minor tweaks to the UI of the page. - Add DevPage button to throw an uncaught error to go into recovery - Add "Delete Save" button in recovery from Game Options (refactored into its own component) - Use "Soft Reset" button from Game Options (refactored into its own component) - The "Soft Reset" & "Delete Save" buttons now have confirmations - Add tooltip on "Disable Recovery Mode" button - Add timestamp to the RECOVERY.json filename - Add textarea containing markdown with the current error details, if available - Error - Page - Version - Environment - Platform - UserAgent - Features - Source - Stack Trace - Change GitHub new issue link to contain default body & title, if possible - Change links to not take the full width (they were clickable by mistake) - Fix "Disable Recovery Mode" not resetting the ErrorBoundary's state, making going back to terminal impossible
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
import { ConfirmationModal } from "./ConfirmationModal";
|
||||
import Button from "@mui/material/Button";
|
||||
import { Tooltip } from '@mui/material';
|
||||
import RestartAltIcon from '@mui/icons-material/RestartAlt';
|
||||
|
||||
interface IProps {
|
||||
color?: "primary" | "warning" | "error";
|
||||
noConfirmation?: boolean;
|
||||
onTriggered: () => void;
|
||||
}
|
||||
|
||||
export function SoftResetButton({ color = "primary", noConfirmation = false, onTriggered }: IProps): React.ReactElement {
|
||||
const [modalOpened, setModalOpened] = useState(false);
|
||||
|
||||
function handleButtonClick(): void {
|
||||
if (noConfirmation) {
|
||||
onTriggered();
|
||||
} else {
|
||||
setModalOpened(true);
|
||||
}
|
||||
}
|
||||
|
||||
return (<>
|
||||
<Tooltip title="Perform a soft reset. Resets everything as if you had just purchased an Augmentation.">
|
||||
<Button startIcon={<RestartAltIcon />} color={color} onClick={handleButtonClick}>Soft Reset</Button>
|
||||
</Tooltip>
|
||||
<ConfirmationModal
|
||||
onConfirm={onTriggered}
|
||||
open={modalOpened}
|
||||
onClose={() => setModalOpened(false)}
|
||||
confirmationText={"This will perform the same action as installing Augmentations, are you sure?"}
|
||||
/>
|
||||
</>)
|
||||
}
|
||||
Reference in New Issue
Block a user