Skip to content

Commit

Permalink
Refactor: update the condition for the activate button
Browse files Browse the repository at this point in the history
  • Loading branch information
chinins committed Aug 31, 2022
1 parent d0a925e commit 8c682ea
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ const StakingWidget = ({
canUserStake && new Decimal(remainingToFullyNayStaked).gt(0);

const canBeStaked = isObjection ? canUserStakeNay : canUserStakeYay;
const showActivateButton =
enoughReputation &&
canBeStaked &&
(!isMinActivated || !enoughActiveTokensToStakeMore);

return (
<div className={styles.main} data-test="stakingWidget">
Expand Down Expand Up @@ -294,9 +298,7 @@ const StakingWidget = ({
/>
<div
className={`${styles.buttonGroup} ${
!isMinActivated || !enoughActiveTokensToStakeMore
? styles.buttonGroupAlignment
: ''
showActivateButton ? styles.buttonGroupAlignment : ''
}`}
>
{!bigNumberify(totalNAYStakes).isZero() && (
Expand Down Expand Up @@ -324,11 +326,7 @@ const StakingWidget = ({

{bigNumberify(totalNAYStakes).isZero() && (
<span
className={
isMinActivated && enoughActiveTokensToStakeMore
? styles.objectButton
: ''
}
className={!showActivateButton ? styles.objectButton : ''}
>
<Button
appearance={{ theme: 'pink', size: 'medium' }}
Expand All @@ -346,7 +344,7 @@ const StakingWidget = ({
/>
</span>
)}
{(!isMinActivated || !enoughActiveTokensToStakeMore) && (
{showActivateButton && (
<Button
appearance={{
theme: 'primary',
Expand Down

0 comments on commit 8c682ea

Please sign in to comment.