Skip to content

Commit 2a13841

Browse files
fix(web): display-stake-button-error
1 parent 54bcb9f commit 2a13841

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx

+22-14
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,18 @@ import { isUndefined } from "utils/index";
2222
import { wrapWithToast } from "utils/wrapWithToast";
2323

2424
import { EnsureChain } from "components/EnsureChain";
25+
import styled from "styled-components";
2526

2627
export enum ActionType {
2728
allowance = "allowance",
2829
stake = "stake",
2930
withdraw = "withdraw",
3031
}
3132

33+
const ErrorLabel = styled.label`
34+
color: ${({ theme }) => theme.error};
35+
`;
36+
3237
interface IActionButton {
3338
isSending: boolean;
3439
parsedAmount: bigint;
@@ -142,20 +147,23 @@ const StakeWithdrawButton: React.FC<IActionButton> = ({
142147
const { text, checkDisabled, onClick } = buttonProps[isAllowance ? ActionType.allowance : action];
143148
return (
144149
<EnsureChain>
145-
<Button
146-
text={text}
147-
isLoading={isSending}
148-
disabled={
149-
isSending ||
150-
parsedAmount == 0n ||
151-
isUndefined(targetStake) ||
152-
isUndefined(courtDetails) ||
153-
checkDisabled() ||
154-
(targetStake !== 0n && targetStake < BigInt(courtDetails.court?.minStake)) ||
155-
(isStaking && !isAllowance && isUndefined(setStakeConfig))
156-
}
157-
onClick={onClick}
158-
/>
150+
<>
151+
<Button
152+
text={text}
153+
isLoading={isSending}
154+
disabled={
155+
isSending ||
156+
parsedAmount == 0n ||
157+
isUndefined(targetStake) ||
158+
isUndefined(courtDetails) ||
159+
checkDisabled() ||
160+
(targetStake !== 0n && targetStake < BigInt(courtDetails.court?.minStake)) ||
161+
(isStaking && !isAllowance && isUndefined(setStakeConfig))
162+
}
163+
onClick={onClick}
164+
/>
165+
{setStakeError && <ErrorLabel> {setStakeError.message}</ErrorLabel>}
166+
</>
159167
</EnsureChain>
160168
);
161169
};

0 commit comments

Comments
 (0)