From d9aff4dc6aa586e310e2eac7c1cfe3b2dc1f188d Mon Sep 17 00:00:00 2001 From: Uncle Fatso Date: Tue, 28 Apr 2026 14:32:51 +0300 Subject: [PATCH] add checkbox if warmup exists during bond purchase Signed-off-by: Uncle Fatso --- package.json | 2 +- .../Bond/components/BondConfirmModal.jsx | 69 +++++++++++++++++-- .../components/StakeConfirmationModal.jsx | 10 ++- 3 files changed, 70 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 305809a..373578c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.7.28", + "version": "0.7.29", "type": "module", "scripts": { "dev": "vite", diff --git a/src/containers/Bond/components/BondConfirmModal.jsx b/src/containers/Bond/components/BondConfirmModal.jsx index 1643c06..921e755 100644 --- a/src/containers/Bond/components/BondConfirmModal.jsx +++ b/src/containers/Bond/components/BondConfirmModal.jsx @@ -1,5 +1,6 @@ -import { useState } from "react"; -import { Box, Typography } from "@mui/material"; +import { useState, useEffect } from "react"; +import { Box, Typography, Checkbox, FormControlLabel } from "@mui/material"; +import { CheckBoxOutlineBlank, CheckBoxOutlined } from "@mui/icons-material"; import { styled, useTheme } from "@mui/material/styles"; import SettingsIcon from '@mui/icons-material/Settings'; import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; @@ -10,13 +11,14 @@ import Metric from "../../../components/Metric/Metric"; import Modal from "../../../components/Modal/Modal"; import TokenStack from "../../../components/TokenStack/TokenStack"; import DataRow from "../../../components/DataRow/DataRow"; -import { PrimaryButton } from "../../../components/Button"; +import { PrimaryButton, SecondaryButton } from "../../../components/Button"; import BondDiscount from "./BondDiscount"; import BondVesting from "./BondVesting"; import BondSlippage from "./BondSlippage"; import { purchaseBond } from "../../../hooks/bonds"; +import { useWarmupLength } from "../../../hooks/staking"; const StyledBox = styled(Box, { shouldForwardProp: prop => prop !== "template", @@ -43,8 +45,57 @@ const BondConfirmModal = ({ handleConfirmClose }) => { const theme = useTheme(); + + const { warmupLength, warmupExists: needsWarmup } = useWarmupLength(chainId); + const [acknowledgedWarmup, setAcknowledgedWarmup] = useState(false); const [isPending, setIsPending] = useState(false); + useEffect(() => setAcknowledgedWarmup(acknowledgedWarmup || !needsWarmup), [acknowledgedWarmup, needsWarmup]); + + const AcknowledgeWarmupCheckbox = () => { + if (!needsWarmup) return <>; + return ( + + setAcknowledgedWarmup(event.target.checked)} + icon={} + checkedIcon={} + /> + } + label={ + + {`I understand the ${bondQuoteTokenName} I’m bonding will only be available to claim ${warmupLength.toString()} epochs after my transaction is confirmed, and the warmup extends with each bond purchase`} + + } + /> + + ); + }; + + const NeedsWarmupDetails = () => { + if (!needsWarmup) return <>; + return ( + <> + + + Why is there a warmup? + + + ); + }; + + const handleConfirmCloseMaster = () => { + setAcknowledgedWarmup(false); + handleConfirmClose() + } + const onSubmit = async () => { setIsPending(true); @@ -68,7 +119,7 @@ const BondConfirmModal = ({ }); setIsPending(false); - handleConfirmClose(); + handleConfirmCloseMaster(); } return ( @@ -84,7 +135,7 @@ const BondConfirmModal = ({ } - onClose={!isPending && handleConfirmClose} + onClose={!isPending && handleConfirmCloseMaster} topLeft={} > <> @@ -110,9 +161,13 @@ const BondConfirmModal = ({ } /> } /> } /> - + {!acknowledgedWarmup && + + + } + {acknowledgedWarmup && {isPending ? "Bonding..." : "Confirm Bond Purchase"} - + } ); diff --git a/src/containers/Stake/components/StakeConfirmationModal.jsx b/src/containers/Stake/components/StakeConfirmationModal.jsx index 9cf971b..072159b 100644 --- a/src/containers/Stake/components/StakeConfirmationModal.jsx +++ b/src/containers/Stake/components/StakeConfirmationModal.jsx @@ -32,15 +32,19 @@ const StakeConfirmationModal = (props) => { setAcknowledgedWarmup(event.target.checked)} icon={} checkedIcon={} /> } - label={`I understand the ${props.ftsoSymbol} I’m staking will only be available to claim ${warmupLength.toString()} epochs after my transaction is confirmed`} - /> + label={ + + {`I understand the ${props.ftsoSymbol} I’m staking will only be available to claim ${warmupLength.toString()} epochs after my transaction is confirmed`} + + } + /> );