Skip to content

Commit

Permalink
enhancement: add warnings for merging vote/stake
Browse files Browse the repository at this point in the history
  • Loading branch information
cvarley100 committed May 31, 2022
1 parent 99ef3ae commit d27c21e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 12 deletions.
15 changes: 14 additions & 1 deletion packages/shared/components/popups/GovernanceManager.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { promptUserToConnectLedger } from 'shared/lib/ledger'
import { hasNodePlugin } from 'shared/lib/networkStatus'
import { showAppNotification } from 'shared/lib/notifications'
import { stakedAmount } from 'shared/lib/participation'
import {
currentAccountTreasuryVotePartiallyUnvotedAmount,
currentAccountTreasuryVoteValue,
Expand Down Expand Up @@ -370,12 +371,24 @@
},
})}
</Text>
<div class="flex items-center mb-6 bg-blue-50 dark:bg-gray-800 rounded-xl p-4">
<div
class="flex items-center {$stakedAmount > 0
? 'mb-4'
: 'mb-6'} bg-blue-50 dark:bg-gray-800 rounded-xl p-4"
>
<Icon icon="exclamation" classes="text-gray-500" />
<Text type="p" classes="px-3">
{localize('popups.governanceManager.mergeVoteDisclaimer')}
</Text>
</div>
{#if $stakedAmount > 0}
<div class="flex items-center mb-6 bg-blue-50 dark:bg-gray-800 rounded-xl p-4">
<Icon icon="exclamation" classes="text-gray-500" />
<Text type="p" classes="px-3">
{localize('popups.governanceManager.mergeVoteDisclaimerStaking')}
</Text>
</div>
{/if}
<div class="flex flex-row justify-between space-x-4 w-full">
<Button
disabled={loading}
Expand Down
21 changes: 12 additions & 9 deletions packages/shared/components/popups/StakingManager.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
shimmerStakingEventState,
resetPerformingParticipation,
} from 'shared/lib/participation/stores'
import { isPartiallyStaked } from 'shared/lib/participation/account'
import { isPartiallyStaked, currentAccountTreasuryVoteValue } from 'shared/lib/participation/account'
import {
AccountParticipationAbility,
Participation,
Expand Down Expand Up @@ -190,6 +190,17 @@

<Text type="h4" classes="mb-2">{localize('popups.stakingManager.title')}</Text>
<Text type="p" secondary classes="mb-4">{localize('popups.stakingManager.description')}</Text>

{#if $currentAccountTreasuryVoteValue}
<TextHint
classes="p-4 rounded-2xl bg-blue-50 dark:bg-gray-800 mb-6"
icon="info"
iconClasses="fill-current text-blue-500 dark:text-blue-500"
hint={localize('popups.stakingManager.mergeStakeDisclaimerVoting')}
hintClasses="text-gray-500 dark:text-gray-500"
/>
{/if}

<div class="staking flex flex-col mb-4">
{#if participationAbility !== AccountParticipationAbility.HasDustAmount}
<div
Expand Down Expand Up @@ -319,14 +330,6 @@
{/if}
</div>

<TextHint
classes="p-4 rounded-2xl bg-blue-50 dark:bg-gray-800"
icon="info"
iconClasses="fill-current text-blue-500 dark:text-blue-500"
hint={localize('popups.stakingManager.singleAccountHint')}
hintClasses="text-gray-500 dark:text-gray-500"
/>

{#if showTooltip}
<Tooltip anchor={tooltipAnchor} position="right">
<Text type="p" classes="text-gray-900 bold mb-1 text-left">
Expand Down
5 changes: 3 additions & 2 deletions packages/shared/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@
"totalFundsStaked": "Total funds staked",
"stakedSuccessfully": "Your funds have been staked for {account}.",
"unstakedSuccessfully": "Your funds have been unstaked for {account}.",
"singleAccountHint": "Looking for your wallets? Firefly has changed. Toggle between your wallets in the top menu bar."
"mergeStakeDisclaimerVoting": "Merging your stake will also merge your votes."
},
"stakingConfirmation": {
"title": "Confirm Participation",
Expand Down Expand Up @@ -878,7 +878,8 @@
"changingVote": "Changing vote",
"manageVotes": "Manage votes",
"partialVoteInfo": "You have received {amount} to {account}. You can vote with these funds by merging them with your current vote.",
"mergeVoteDisclaimer": "Please note that merging votes won't impact any votes that have already been counted",
"mergeVoteDisclaimer": "Please note that merging votes won't impact any votes that have already been counted.",
"mergeVoteDisclaimerStaking": "Merging your vote will also merge your staked funds.",
"mergingVotes": "Merging votes",
"votedSuccessfully": "You have started voting with {account}.",
"unvotedSuccessfully": "You have stopped voting with {account}.",
Expand Down

0 comments on commit d27c21e

Please sign in to comment.