Skip to content

Commit faac7b8

Browse files
authored
Merge branch 'develop' into refactor/swap-module
2 parents ed7966c + 575857b commit faac7b8

File tree

5 files changed

+49
-26
lines changed

5 files changed

+49
-26
lines changed

apps/wallet-mobile/src/legacy/Dashboard/DashboardNavigator.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const DashboardNavigator = () => {
3333
>
3434
<Stack.Screen
3535
name="staking-dashboard-main"
36-
component={Dashboard}
36+
getComponent={() => Dashboard}
3737
options={{
3838
title: meta.name,
3939
}}

apps/wallet-mobile/src/legacy/Dashboard/StakePoolInfo.tsx

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {PoolInfoApi} from '@emurgo/yoroi-lib'
12
import {useTheme} from '@yoroi/theme'
23
import React from 'react'
34
import {defineMessages, useIntl} from 'react-intl'
@@ -8,6 +9,7 @@ import {Button, ButtonType} from '../../components/Button/Button'
89
import {CopyButton} from '../../components/CopyButton'
910
import {Text} from '../../components/Text'
1011
import {TitledCard} from '../../components/TitledCard'
12+
import {useSelectedNetwork} from '../../features/WalletManager/common/hooks/useSelectedNetwork'
1113
import {useSelectedWallet} from '../../features/WalletManager/common/hooks/useSelectedWallet'
1214
import {isEmptyString} from '../../kernel/utils'
1315
import {YoroiWallet} from '../../yoroi-wallets/cardano/types'
@@ -16,11 +18,12 @@ import {StakePoolInfoAndHistory} from '../../yoroi-wallets/types/staking'
1618
export const StakePoolInfo = ({stakePoolId}: {stakePoolId: string}) => {
1719
const strings = useStrings()
1820
const styles = useStyles()
21+
const {isDark} = useTheme()
1922
const {wallet} = useSelectedWallet()
2023
const {stakePoolInfoAndHistory, isLoading} = useStakePoolInfoAndHistory({wallet, stakePoolId})
2124
const homepage = stakePoolInfoAndHistory?.info?.homepage
2225

23-
if (isLoading) return <ActivityIndicator size="large" color="black" />
26+
if (isLoading) return <ActivityIndicator size="large" color={isDark ? 'white' : 'black'} />
2427
if (!stakePoolInfoAndHistory?.info) return null
2528

2629
return (
@@ -63,13 +66,31 @@ export const useStakePoolInfoAndHistory = (
6366
[string, string, string]
6467
>,
6568
) => {
69+
const {networkManager} = useSelectedNetwork()
70+
const poolInfoApi = React.useMemo(
71+
() => new PoolInfoApi(networkManager.legacyApiBaseUrl),
72+
[networkManager.legacyApiBaseUrl],
73+
)
6674
const query = useQuery({
6775
...options,
6876
queryKey: [wallet.id, 'stakePoolInfo', stakePoolId],
6977
queryFn: async () => {
7078
const stakePoolInfosAndHistories = await wallet.fetchPoolInfo({poolIds: [stakePoolId]})
7179

72-
return stakePoolInfosAndHistories[stakePoolId]
80+
if (stakePoolInfosAndHistories[stakePoolId]?.info?.name != null) return stakePoolInfosAndHistories[stakePoolId]
81+
82+
const history = stakePoolInfosAndHistories[stakePoolId]?.history
83+
if (history == null) return null
84+
85+
const explorerPoolInfo = await poolInfoApi.getSingleExplorerPoolInfo(stakePoolId)
86+
87+
return {
88+
history,
89+
info: {
90+
name: explorerPoolInfo?.name ?? '',
91+
ticker: explorerPoolInfo?.ticker ?? '',
92+
},
93+
}
7394
},
7495
})
7596

apps/wallet-mobile/src/legacy/Dashboard/StakePoolInfos.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {useTheme} from '@yoroi/theme'
12
import {Balance, Wallet} from '@yoroi/types'
23
import BigNumber from 'bignumber.js'
34
import React from 'react'
@@ -14,6 +15,7 @@ import {StakePoolInfo} from './StakePoolInfo'
1415
export const StakePoolInfos = () => {
1516
const {wallet} = useSelectedWallet()
1617
const {stakePoolIds, isLoading} = useStakePoolIds(wallet)
18+
const {isDark} = useTheme()
1719

1820
return stakePoolIds != null ? (
1921
<View>
@@ -23,7 +25,7 @@ export const StakePoolInfos = () => {
2325
</View>
2426
) : isLoading ? (
2527
<View style={styles.activityIndicator}>
26-
<ActivityIndicator size="large" color="black" />
28+
<ActivityIndicator size="large" color={isDark ? 'white' : 'black'} />
2729
</View>
2830
) : null
2931
}

apps/wallet-mobile/translations/messages/src/legacy/Dashboard/DashboardNavigator.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"start": {
77
"line": 76,
88
"column": 9,
9-
"index": 2279
9+
"index": 2288
1010
},
1111
"end": {
1212
"line": 79,
1313
"column": 3,
14-
"index": 2367
14+
"index": 2376
1515
}
1616
}
1717
]

apps/wallet-mobile/translations/messages/src/legacy/Dashboard/StakePoolInfo.json

+20-20
Original file line numberDiff line numberDiff line change
@@ -4,74 +4,74 @@
44
"defaultMessage": "!!!Stake pool delegated",
55
"file": "src/legacy/Dashboard/StakePoolInfo.tsx",
66
"start": {
7-
"line": 105,
7+
"line": 126,
88
"column": 9,
9-
"index": 3212
9+
"index": 4022
1010
},
1111
"end": {
12-
"line": 108,
12+
"line": 129,
1313
"column": 3,
14-
"index": 3333
14+
"index": 4143
1515
}
1616
},
1717
{
1818
"id": "components.delegationsummary.delegatedStakepoolInfo.warning",
1919
"defaultMessage": "!!!If you just delegated to a new stake pool it may take a couple of minutes for the network to process your request.",
2020
"file": "src/legacy/Dashboard/StakePoolInfo.tsx",
2121
"start": {
22-
"line": 109,
22+
"line": 130,
2323
"column": 11,
24-
"index": 3346
24+
"index": 4156
2525
},
2626
"end": {
27-
"line": 114,
27+
"line": 135,
2828
"column": 3,
29-
"index": 3581
29+
"index": 4391
3030
}
3131
},
3232
{
3333
"id": "components.delegationsummary.delegatedStakepoolInfo.fullDescriptionButtonLabel",
3434
"defaultMessage": "!!!Go to website",
3535
"file": "src/legacy/Dashboard/StakePoolInfo.tsx",
3636
"start": {
37-
"line": 115,
37+
"line": 136,
3838
"column": 26,
39-
"index": 3609
39+
"index": 4419
4040
},
4141
"end": {
42-
"line": 118,
42+
"line": 139,
4343
"column": 3,
44-
"index": 3744
44+
"index": 4554
4545
}
4646
},
4747
{
4848
"id": "components.delegationsummary.delegatedStakepoolInfo.copied",
4949
"defaultMessage": "!!!Copied!",
5050
"file": "src/legacy/Dashboard/StakePoolInfo.tsx",
5151
"start": {
52-
"line": 119,
52+
"line": 140,
5353
"column": 10,
54-
"index": 3756
54+
"index": 4566
5555
},
5656
"end": {
57-
"line": 122,
57+
"line": 143,
5858
"column": 3,
59-
"index": 3865
59+
"index": 4675
6060
}
6161
},
6262
{
6363
"id": "components.delegationsummary.delegatedStakepoolInfo.unknownPool",
6464
"defaultMessage": "!!!Unknown pool",
6565
"file": "src/legacy/Dashboard/StakePoolInfo.tsx",
6666
"start": {
67-
"line": 123,
67+
"line": 144,
6868
"column": 15,
69-
"index": 3882
69+
"index": 4692
7070
},
7171
"end": {
72-
"line": 126,
72+
"line": 147,
7373
"column": 3,
74-
"index": 4001
74+
"index": 4811
7575
}
7676
}
7777
]

0 commit comments

Comments
 (0)