Skip to content

Commit

Permalink
Merge pull request #4248 from JoinColony/fix/3909-completed-motion-st…
Browse files Browse the repository at this point in the history
…ake-error

fix: dont show staking errors if the motion is completed
  • Loading branch information
bassgeta authored Feb 6, 2025
2 parents 2c31f1d + ff073b6 commit 9d6af14
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const StakingStep: FC<StakingStepProps> = ({ className, isActive }) => {
motionStakes,
requiredStake,
motionDomain: { metadata },
isFinalized,
} = motionData;

const { nativeToken } = colony;
Expand Down Expand Up @@ -78,6 +79,14 @@ const StakingStep: FC<StakingStepProps> = ({ className, isActive }) => {
return 'motion.staking.status.text';
})();

const canUserStake = canInteract && !isFinalized;
const shouldShowNotEnoughReputation =
!enoughReputationToStakeMinimum && canUserStake;
const shouldShowNotEnoughTokens =
!enoughTokensToStakeMinimum &&
enoughReputationToStakeMinimum &&
canUserStake;

return isLoading ? (
<SpinnerLoader />
) : (
Expand Down Expand Up @@ -110,7 +119,7 @@ const StakingStep: FC<StakingStepProps> = ({ className, isActive }) => {
</StatusText>
}
sections={[
...(!enoughReputationToStakeMinimum && canInteract
...(shouldShowNotEnoughReputation
? [
{
key: '1',
Expand All @@ -128,9 +137,7 @@ const StakingStep: FC<StakingStepProps> = ({ className, isActive }) => {
},
]
: []),
...(!enoughTokensToStakeMinimum &&
enoughReputationToStakeMinimum &&
canInteract
...(shouldShowNotEnoughTokens
? [
{
key: '2',
Expand Down

0 comments on commit 9d6af14

Please sign in to comment.