mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
Add confirmation modal to crafting
This commit is contained in:
parent
16fa4c8d7f
commit
d6e0180116
@ -5,6 +5,7 @@ import { Construction } from "@mui/icons-material";
|
|||||||
|
|
||||||
import { use } from "../../../ui/Context";
|
import { use } from "../../../ui/Context";
|
||||||
import { Money } from "../../../ui/React/Money";
|
import { Money } from "../../../ui/React/Money";
|
||||||
|
import { ConfirmationModal } from "../../../ui/React/ConfirmationModal";
|
||||||
import { Augmentations } from "../../../Augmentation/Augmentations";
|
import { Augmentations } from "../../../Augmentation/Augmentations";
|
||||||
import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames";
|
||||||
import { Settings } from "../../../Settings/Settings";
|
import { Settings } from "../../../Settings/Settings";
|
||||||
@ -43,6 +44,7 @@ export const GraftingRoot = (): React.ReactElement => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [selectedAug, setSelectedAug] = useState(getAvailableAugs(player)[0]);
|
const [selectedAug, setSelectedAug] = useState(getAvailableAugs(player)[0]);
|
||||||
|
const [craftOpen, setCraftOpen] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container disableGutters maxWidth="lg" sx={{ mx: 0 }}>
|
<Container disableGutters maxWidth="lg" sx={{ mx: 0 }}>
|
||||||
@ -75,14 +77,7 @@ export const GraftingRoot = (): React.ReactElement => {
|
|||||||
<Construction sx={{ mr: 1 }} /> {selectedAug}
|
<Construction sx={{ mr: 1 }} /> {selectedAug}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Button
|
<Button
|
||||||
onClick={(event) => {
|
onClick={() => setCraftOpen(true)}
|
||||||
if (!event.isTrusted) return;
|
|
||||||
const craftableAug = CraftableAugmentations[selectedAug];
|
|
||||||
player.loseMoney(craftableAug.cost, "augmentations");
|
|
||||||
player.startCraftAugmentationWork(selectedAug, craftableAug.time);
|
|
||||||
player.startFocusing();
|
|
||||||
router.toWork();
|
|
||||||
}}
|
|
||||||
sx={{ width: "100%" }}
|
sx={{ width: "100%" }}
|
||||||
disabled={player.money < CraftableAugmentations[selectedAug].cost}
|
disabled={player.money < CraftableAugmentations[selectedAug].cost}
|
||||||
>
|
>
|
||||||
@ -92,6 +87,26 @@ export const GraftingRoot = (): React.ReactElement => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
)
|
)
|
||||||
</Button>
|
</Button>
|
||||||
|
<ConfirmationModal
|
||||||
|
open={craftOpen}
|
||||||
|
onClose={() => setCraftOpen(false)}
|
||||||
|
onConfirm={() => {
|
||||||
|
const craftableAug = CraftableAugmentations[selectedAug];
|
||||||
|
player.loseMoney(craftableAug.cost, "augmentations");
|
||||||
|
player.startCraftAugmentationWork(selectedAug, craftableAug.time);
|
||||||
|
player.startFocusing();
|
||||||
|
router.toWork();
|
||||||
|
}}
|
||||||
|
confirmationText={
|
||||||
|
<>
|
||||||
|
Cancelling crafting will <b>not</b> save crafting progress, and the money you spend will <b>not</b> be
|
||||||
|
returned.
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
Additionally, grafting an Augmentation will increase the potency of the Entropy virus.
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
/>
|
||||||
<Typography color={Settings.theme.info}>
|
<Typography color={Settings.theme.info}>
|
||||||
<b>Time to Craft:</b> {convertTimeMsToTimeElapsedString(CraftableAugmentations[selectedAug].time)}
|
<b>Time to Craft:</b> {convertTimeMsToTimeElapsedString(CraftableAugmentations[selectedAug].time)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
Loading…
Reference in New Issue
Block a user