Skip to content

Commit

Permalink
enhancement: wraps manage voting power popup in a form
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeanribeiro committed Dec 31, 2022
1 parent a5d33ed commit c25a4b2
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions packages/shared/components/popups/ManageVotingPowerPopup.svelte
@@ -1,6 +1,6 @@
<script lang="typescript">
import { TextType } from 'shared/components/enums'
import { Button, Text, TextHint, AssetAmountInput } from 'shared/components'
import { HTMLButtonType, TextType } from 'shared/components/enums'
import { selectedAccount } from '@core/account'
import { handleError } from '@core/error/handlers/handleError'
import { setVotingPower } from '@contexts/governance/actions'
Expand All @@ -21,7 +21,7 @@
closePopup()
}
async function onConfirmClick(): Promise<void> {
async function onSubmit(): Promise<void> {
try {
await assetAmountInput?.validate()
await checkActiveProfileAuth(async () => {
Expand All @@ -35,25 +35,27 @@
}
</script>

<Text type={TextType.h4} classes="mb-3">{localize('popups.manageVotingPower.title')}</Text>
<Text type={TextType.p} secondary classes="mb-5">{localize('popups.manageVotingPower.body')}</Text>
<div class="space-y-4 mb-6">
<AssetAmountInput
bind:this={assetAmountInput}
bind:rawAmount
{asset}
containsSlider
disableAssetSelection
disabled={isTransferring}
{votingPower}
/>
<TextHint info text={localize('popups.manageVotingPower.hint')} />
</div>
<div class="flex flex-row flex-nowrap w-full space-x-4">
<Button outline classes="w-full" disabled={isTransferring} onClick={onCancelClick}>
{localize('actions.cancel')}
</Button>
<Button classes="w-full" disabled={isTransferring} onClick={onConfirmClick} isBusy={isTransferring}>
{localize('actions.confirm')}
</Button>
</div>
<form id="manage-voting-power" on:submit|preventDefault={onSubmit}>
<Text type={TextType.h4} classes="mb-3">{localize('popups.manageVotingPower.title')}</Text>
<Text type={TextType.p} secondary classes="mb-5">{localize('popups.manageVotingPower.body')}</Text>
<div class="space-y-4 mb-6">
<AssetAmountInput
bind:this={assetAmountInput}
bind:rawAmount
{asset}
containsSlider
disableAssetSelection
disabled={isTransferring}
{votingPower}
/>
<TextHint info text={localize('popups.manageVotingPower.hint')} />
</div>
<div class="flex flex-row flex-nowrap w-full space-x-4">
<Button outline classes="w-full" disabled={isTransferring} onClick={onCancelClick}>
{localize('actions.cancel')}
</Button>
<Button type={HTMLButtonType.Submit} disabled={isTransferring} isBusy={isTransferring} classes="w-full">
{localize('actions.confirm')}
</Button>
</div>
</form>

0 comments on commit c25a4b2

Please sign in to comment.