changes in confirmation logic for bond redeem, only if funds on the bonding contract are in warmup period

Signed-off-by: Uncle Fatso <uncle.fatso@ghostchain.io>
This commit is contained in:
Uncle Fatso 2025-04-28 17:32:16 +03:00
parent d4446f6fb1
commit bbfbc36fd8
Signed by: f4ts0
GPG Key ID: 565F4F2860226EBB

View File

@ -1,7 +1,8 @@
import { useState } from "react";
import { Box, Typography } from "@mui/material";
import { Box, Typography, FormControlLabel, Checkbox } from "@mui/material";
import { styled, useTheme } from "@mui/material/styles";
import SettingsIcon from '@mui/icons-material/Settings';
import { CheckBoxOutlineBlank, CheckBoxOutlined } from "@mui/icons-material";
import Modal from "../../../components/Modal/Modal";
import { PrimaryButton } from "../../../components/Button";
@ -30,6 +31,8 @@ const WarmupConfirmModal = ({
}) => {
const theme = useTheme();
const [isChecked, setIsChecked] = useState(false);
const onSubmit = () => {
setPreClaimConfirmed();
handleConfirmClose();
@ -38,25 +41,35 @@ const WarmupConfirmModal = ({
return (
<Modal
maxWidth="476px"
minHeight={warmupLength >= 0 ? "150px" : "200px"}
minHeight="150px"
open={isOpen}
headerText={
warmupLength >= 0
? "Bond Warm-Up is Pending..."
: "Unlock Bond"
warmupLength < 0
? "Bond Notification"
: "Bond in Warm-up"
}
onClose={handleConfirmClose}
>
<Box gap="20px" display="flex" flexDirection="column" justifyContent="space-between" alignItems="center">
<Box display="flex" flexDirection="column">
<Typography>{
warmupLength >= 0
? `This bond is currently in a warm-up period and cannot be claimed yet. It'll be available for claim in ${warmupLength} epochs.`
: "This bond is warmed-up and can be unlocked. Please unlock it on behalf of the collective."
}</Typography>
{warmupLength < 0
? <FormControlLabel
control={
<Checkbox
data-testid="acknowledge-warmup"
checked={isChecked}
onChange={event => setIsChecked(event.target.checked)}
icon={<CheckBoxOutlineBlank viewBox="0 0 24 24" />}
checkedIcon={<CheckBoxOutlined viewBox="0 0 24 24" />}
/>
}
label={`I acknowledge that I am releasing warmup funds for the bonding contract on behalf of the collective.`}
/>
: `Bonding address is in a warm-up period and cannot be claimed now. It'll be available for claim in ${warmupLength} epochs.`
}
</Box>
{warmupLength < 0 && <PrimaryButton fullWidth onClick={onSubmit}>
{warmupLength < 0 && <PrimaryButton fullWidth disabled={!isChecked} onClick={onSubmit}>
Confirm
</PrimaryButton>}
</Box>