-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathDashboardNavigator.tsx
80 lines (70 loc) · 2.33 KB
/
DashboardNavigator.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* eslint-disable @typescript-eslint/no-explicit-any */
import {createStackNavigator} from '@react-navigation/stack'
import {GovernanceProvider} from '@yoroi/staking'
import {useTheme} from '@yoroi/theme'
import React from 'react'
import {defineMessages, useIntl} from 'react-intl'
import {NetworkTag} from '../../features/Settings/useCases/changeAppSettings/ChangeNetwork/NetworkTag'
import {useGovernanceManagerMaker} from '../../features/Staking/Governance/common/helpers'
import {useSelectedWallet} from '../../features/WalletManager/common/hooks/useSelectedWallet'
import {DashboardRoutes, defaultStackNavigationOptions} from '../../kernel/navigation'
import {StakingCenter} from '../Staking/StakingCenter'
import {Dashboard} from './Dashboard'
import {FailedTxScreen} from './ShowFailedTxScreen/FailedTxScreen'
import {SubmittedTxScreen} from './ShowSubmittedTxScreen/SubmittedTxScreen'
const Stack = createStackNavigator<DashboardRoutes>()
export const DashboardNavigator = () => {
const {meta} = useSelectedWallet()
const strings = useStrings()
const {color, atoms} = useTheme()
const manager = useGovernanceManagerMaker()
return (
<GovernanceProvider manager={manager}>
<Stack.Navigator
screenOptions={{
...defaultStackNavigationOptions(atoms, color),
title: strings.title,
headerTitle: ({children}) => <NetworkTag>{children}</NetworkTag>,
}}
>
<Stack.Screen
name="staking-dashboard-main"
getComponent={() => Dashboard}
options={{
title: meta.name,
}}
/>
<Stack.Screen //
name="staking-center"
component={StakingCenter}
/>
<Stack.Screen //
name="staking-submitted-tx"
component={SubmittedTxScreen}
options={{
headerShown: false,
}}
/>
<Stack.Screen //
name="staking-failed-tx"
component={FailedTxScreen}
options={{
headerShown: false,
}}
/>
</Stack.Navigator>
</GovernanceProvider>
)
}
const useStrings = () => {
const intl = useIntl()
return {
title: intl.formatMessage(messages.title),
}
}
const messages = defineMessages({
title: {
id: 'components.stakingcenter.title',
defaultMessage: '!!!Staking Center',
},
})