import React, { useState } from "react";
import { Button, Tooltip } from "@mui/material";
import { ConfirmationModal } from "./ConfirmationModal";
import RestartAltIcon from "@mui/icons-material/RestartAlt";
import { knowAboutBitverse } from "../../BitNode/BitNodeUtils";
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);
}
}
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 (crime, study, ${knowAboutBitverse() ? `Bladeburner action, Grafting task, ` : ""}etc.)
- You will not lose overall progress or access to special mechanics
Are you sure?
`;
return (
<>
} color={color} onClick={handleButtonClick}>
Soft Reset
setModalOpened(false)}
confirmationText={{confirmationMessage}}
additionalButton={}
/>
>
);
}