From d6e01801161d25ca7686bd905e580035ceb050d7 Mon Sep 17 00:00:00 2001 From: nickofolas <60761231+nickofolas@users.noreply.github.com> Date: Mon, 21 Mar 2022 14:54:39 -0500 Subject: [PATCH] Add confirmation modal to crafting --- .../Grafting/ui/GraftingRoot.tsx | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx index a59e32608..055ed5d6e 100644 --- a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx +++ b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx @@ -5,6 +5,7 @@ import { Construction } from "@mui/icons-material"; import { use } from "../../../ui/Context"; import { Money } from "../../../ui/React/Money"; +import { ConfirmationModal } from "../../../ui/React/ConfirmationModal"; import { Augmentations } from "../../../Augmentation/Augmentations"; import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames"; import { Settings } from "../../../Settings/Settings"; @@ -43,6 +44,7 @@ export const GraftingRoot = (): React.ReactElement => { } const [selectedAug, setSelectedAug] = useState(getAvailableAugs(player)[0]); + const [craftOpen, setCraftOpen] = useState(false); return ( @@ -75,14 +77,7 @@ export const GraftingRoot = (): React.ReactElement => { {selectedAug} + 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 not save crafting progress, and the money you spend will not be + returned. +
+
+ Additionally, grafting an Augmentation will increase the potency of the Entropy virus. + + } + /> Time to Craft: {convertTimeMsToTimeElapsedString(CraftableAugmentations[selectedAug].time)}