Skip to content

Commit

Permalink
Merge pull request #2236 from JoinColony/fix/15873332-finalize-step
Browse files Browse the repository at this point in the history
fix: changed failed finalize step content
  • Loading branch information
CzarekDryl authored Apr 17, 2024
2 parents 0e67a00 + e49db4b commit 4668157
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ const FinalizeStep: FC<FinalizeStepProps> = ({
<MenuWithStatusText
statusTextSectionProps={{
status: StatusTypes.Info,
children: formatText({ id: 'motion.finalizeStep.statusText' }),
children: formatText({
id: isMotionFailedNotFinalizable
? 'motion.finalizeStep.failed.statusText'
: 'motion.finalizeStep.statusText',
}),
textClassName: 'text-4',
iconAlignment: 'top',
content: (
Expand Down Expand Up @@ -166,7 +170,8 @@ const FinalizeStep: FC<FinalizeStepProps> = ({
items={items}
className={clsx({
'mb-6':
!isMotionFinalized || (!isClaimed && canClaimStakes),
!isMotionFailedNotFinalizable &&
(!isMotionFinalized || (!isClaimed && canClaimStakes)),
})}
/>
)}
Expand All @@ -184,18 +189,22 @@ const FinalizeStep: FC<FinalizeStepProps> = ({
}
/>
)}
{!isPolling && !isMotionFinalized && !isMotionAgreement && (
<Button
mode="primarySolid"
disabled={!isFinalizable || wrongMotionState}
isFullSize
text={formatText({
id: 'motion.finalizeStep.submit',
})}
type="submit"
/>
)}
{!isPolling &&
!isMotionFailedNotFinalizable &&
!isMotionFinalized &&
!isMotionAgreement && (
<Button
mode="primarySolid"
disabled={!isFinalizable || wrongMotionState}
isFullSize
text={formatText({
id: 'motion.finalizeStep.submit',
})}
type="submit"
/>
)}
{!isPolling &&
!isMotionFailedNotFinalizable &&
isMotionClaimable &&
!isClaimed &&
canClaimStakes && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ export const useClaimConfig = (
const userAddress = user?.walletAddress;
const nativeTokenDecimals = nativeToken.decimals;
const nativeTokenSymbol = ` ${nativeToken.symbol}`;
const isMotionFailedNotFinalizable =
actionData.motionData.motionStateHistory.hasFailedNotFinalizable;

const userStake = usersStakes.find(({ address }) => address === userAddress);
const stakerReward = stakerRewards.find(
Expand Down Expand Up @@ -226,6 +228,36 @@ export const useClaimConfig = (
},
);
}
if (isMotionFailedNotFinalizable) {
items.push(
{
key: WinningsItems.Winnings,
label: formatText({ id: 'motion.finalizeStep.winnings' }),
value: (
<div>
<Numeral
value={0}
decimals={nativeTokenDecimals}
suffix={nativeTokenSymbol}
/>
</div>
),
},
{
key: WinningsItems.Total,
label: formatText({ id: 'motion.finalizeStep.total' }),
value: (
<div>
<Numeral
value={0}
decimals={nativeTokenDecimals}
suffix={nativeTokenSymbol}
/>
</div>
),
},
);
}

return {
items,
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1382,9 +1382,10 @@
"motion.staking.accordion.title.hide": "Hide staking information",
"motion.finalize.label": "Finalize",
"motion.finalizeStep.statusText": "Finalize to execute the agreed transactions and return stakes.",
"motion.finalizeStep.failed.statusText": "Action failed due to not achieving required stake.",
"motion.finalizeStep.title": "Staking overview",
"motion.finalizeStep.staked": "Staked",
"motion.finalizeStep.winnings": "Winnings",
"motion.finalizeStep.winnings": "Reward",
"motion.finalizeStep.total": "Total",
"motion.finalizeStep.submit": "Finalize",
"motion.finalizeStep.returnStakes": "Return stakes",
Expand Down

0 comments on commit 4668157

Please sign in to comment.