Skip to content

Commit

Permalink
release(wallet-mobile): v4.27.1-rc.1 pool transition fixes (#3292)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorbuedo authored Jun 11, 2024
1 parent fddd0fd commit 9548743
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Balance} from '@yoroi/types'
import React, {useEffect, useState} from 'react'
import {defineMessages, useIntl} from 'react-intl'
import {Platform, ScrollView, StyleSheet, View, ViewProps} from 'react-native'
import {useQueryClient} from 'react-query'

import {KeyboardSpacer, Text, ValidatedTextInput} from '../../components'
import {ConfirmTx} from '../../components/ConfirmTx'
Expand Down Expand Up @@ -35,6 +36,7 @@ export const DelegationConfirmation = () => {
const wallet = useSelectedWallet()
const strings = useStrings()
const styles = useStyles()
const queryClient = useQueryClient()

const {poolId, yoroiUnsignedTx} = useParams<Params>(isParams)

Expand All @@ -50,6 +52,7 @@ export const DelegationConfirmation = () => {
}, [])

const onSuccess = () => {
queryClient.resetQueries([wallet.id, 'stakingInfo'])
resetToTxHistory()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export const PoolTransitionModal = ({
onContinue,
}: {
poolTransition: PoolTransition
onContinue: () => void
onContinue: () => Promise<void> | void
}) => {
const [isLoading, setIsLoading] = React.useState(false)
const {styles, colors} = useStyles()
const strings = useStrings()

Expand All @@ -25,9 +26,14 @@ export const PoolTransitionModal = ({
closeModal()
}

const handleOnUpdate = () => {
closeModal()
onContinue()
const handleOnUpdate = async () => {
try {
setIsLoading(true)
await onContinue()
} finally {
setIsLoading(false)
closeModal()
}
}

const timeSpan = poolTransition.deadlineMilliseconds - Date.now()
Expand All @@ -37,7 +43,9 @@ export const PoolTransitionModal = ({
<View style={styles.modal}>
<Text style={styles.details}>{isActive ? strings.warning : strings.finalWarning}</Text>

<Space fill height="l" />
<Space fill />

<Space height="l" />

<View style={[styles.card, isActive ? styles.border : styles.warningBorder]}>
<Row>
Expand Down Expand Up @@ -127,7 +135,13 @@ export const PoolTransitionModal = ({
<Actions>
<Button outline title={strings.skipNoRewards} textStyles={styles.outlineButton} onPress={handleOnSkip} />

<Button shelleyTheme title={strings.updateKeepEarning} onPress={handleOnUpdate} textStyles={styles.button} />
<Button
shelleyTheme
title={strings.updateKeepEarning}
onPress={handleOnUpdate}
textStyles={styles.button}
disabled={isLoading}
/>
</Actions>

<Space height="xl" />
Expand Down
2 changes: 1 addition & 1 deletion apps/wallet-mobile/src/features/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const features = {
showProdPoolsInDev: __DEV__,
moderatingNftsEnabled: false,
walletListFeedback: __DEV__,
poolTransition: __DEV__,
poolTransition: true,
}

export const debugWalletInfo = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,59 +4,59 @@
"defaultMessage": "!!!Delegate",
"file": "src/Staking/DelegationConfirmation/DelegationConfirmation.tsx",
"start": {
"line": 151,
"line": 154,
"column": 23,
"index": 5517
"index": 5656
},
"end": {
"line": 154,
"line": 157,
"column": 3,
"index": 5631
"index": 5770
}
},
{
"id": "components.stakingcenter.confirmDelegation.ofFees",
"defaultMessage": "!!!of fees",
"file": "src/Staking/DelegationConfirmation/DelegationConfirmation.tsx",
"start": {
"line": 155,
"line": 158,
"column": 10,
"index": 5643
"index": 5782
},
"end": {
"line": 158,
"line": 161,
"column": 3,
"index": 5743
"index": 5882
}
},
{
"id": "components.stakingcenter.confirmDelegation.rewardsExplanation",
"defaultMessage": "!!!Current approximation of rewards that you will receive per epoch:",
"file": "src/Staking/DelegationConfirmation/DelegationConfirmation.tsx",
"start": {
"line": 159,
"line": 162,
"column": 22,
"index": 5767
"index": 5906
},
"end": {
"line": 162,
"line": 165,
"column": 3,
"index": 5937
"index": 6076
}
},
{
"id": "components.delegationsummary.delegatedStakepoolInfo.unknownPool",
"defaultMessage": "!!!Unknown pool",
"file": "src/Staking/DelegationConfirmation/DelegationConfirmation.tsx",
"start": {
"line": 163,
"line": 166,
"column": 15,
"index": 5954
"index": 6093
},
"end": {
"line": 166,
"line": 169,
"column": 3,
"index": 6073
"index": 6212
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
"start": {
"line": 114,
"column": 9,
"index": 4001
"index": 4044
},
"end": {
"line": 117,
"column": 3,
"index": 4099
"index": 4142
}
},
{
Expand All @@ -21,12 +21,12 @@
"start": {
"line": 118,
"column": 11,
"index": 4112
"index": 4155
},
"end": {
"line": 122,
"column": 3,
"index": 4308
"index": 4351
}
},
{
Expand All @@ -36,12 +36,12 @@
"start": {
"line": 123,
"column": 16,
"index": 4326
"index": 4369
},
"end": {
"line": 127,
"column": 3,
"index": 4532
"index": 4575
}
},
{
Expand All @@ -51,12 +51,12 @@
"start": {
"line": 128,
"column": 15,
"index": 4549
"index": 4592
},
"end": {
"line": 131,
"column": 3,
"index": 4642
"index": 4685
}
},
{
Expand All @@ -66,12 +66,12 @@
"start": {
"line": 132,
"column": 11,
"index": 4655
"index": 4698
},
"end": {
"line": 135,
"column": 3,
"index": 4740
"index": 4783
}
},
{
Expand All @@ -81,12 +81,12 @@
"start": {
"line": 136,
"column": 16,
"index": 4758
"index": 4801
},
"end": {
"line": 139,
"column": 3,
"index": 4853
"index": 4896
}
},
{
Expand All @@ -96,12 +96,12 @@
"start": {
"line": 140,
"column": 7,
"index": 4862
"index": 4905
},
"end": {
"line": 143,
"column": 3,
"index": 4938
"index": 4981
}
},
{
Expand All @@ -111,12 +111,12 @@
"start": {
"line": 144,
"column": 24,
"index": 4964
"index": 5007
},
"end": {
"line": 147,
"column": 3,
"index": 5101
"index": 5144
}
},
{
Expand All @@ -126,12 +126,12 @@
"start": {
"line": 148,
"column": 17,
"index": 5120
"index": 5163
},
"end": {
"line": 151,
"column": 3,
"index": 5254
"index": 5297
}
},
{
Expand All @@ -141,12 +141,12 @@
"start": {
"line": 152,
"column": 23,
"index": 5279
"index": 5322
},
"end": {
"line": 155,
"column": 3,
"index": 5409
"index": 5452
}
},
{
Expand All @@ -156,12 +156,12 @@
"start": {
"line": 156,
"column": 17,
"index": 5428
"index": 5471
},
"end": {
"line": 159,
"column": 3,
"index": 5542
"index": 5585
}
},
{
Expand All @@ -171,12 +171,12 @@
"start": {
"line": 160,
"column": 21,
"index": 5565
"index": 5608
},
"end": {
"line": 163,
"column": 3,
"index": 5679
"index": 5722
}
},
{
Expand All @@ -186,12 +186,12 @@
"start": {
"line": 164,
"column": 10,
"index": 5691
"index": 5734
},
"end": {
"line": 167,
"column": 3,
"index": 5778
"index": 5821
}
}
]

0 comments on commit 9548743

Please sign in to comment.