1
- import { Divider , IconButton } from "@material-ui/core" ;
2
- import { BurnMachineSchema , GatewaySession } from "@renproject/ren-tx" ;
3
- import React , {
4
- FunctionComponent ,
5
- useCallback ,
6
- useEffect ,
7
- useState ,
8
- } from "react" ;
9
- import { useDispatch , useSelector } from "react-redux" ;
10
- import { RouteComponentProps , useHistory } from "react-router-dom" ;
11
- import {
12
- ActionButton ,
13
- ToggleIconButton ,
14
- } from "../../../components/buttons/Buttons" ;
15
- import { NumberFormatText } from "../../../components/formatting/NumberFormatText" ;
16
- import { BackArrowIcon } from "../../../components/icons/RenIcons" ;
17
- import {
18
- BigWrapper ,
19
- CenteringSpacedBox ,
20
- MediumWrapper ,
21
- } from "../../../components/layout/LayoutHelpers" ;
22
- import {
23
- PaperActions ,
24
- PaperContent ,
25
- PaperHeader ,
26
- PaperNav ,
27
- PaperTitle ,
28
- } from "../../../components/layout/Paper" ;
29
- import {
30
- LabelWithValue ,
31
- SpacedDivider ,
32
- } from "../../../components/typography/TypographyHelpers" ;
33
- import { Debug } from "../../../components/utils/Debug" ;
34
- import { WalletStatus } from "../../../components/utils/types" ;
35
- import { WalletConnectionProgress } from "../../../components/wallet/WalletHelpers" ;
36
- import { usePageTitle } from "../../../hooks/usePageTitle" ;
37
- import { usePaperTitle } from "../../../pages/MainPage" ;
38
- import { paths } from "../../../pages/routes" ;
39
- import { useSelectedChainWallet } from "../../../providers/multiwallet/multiwalletHooks" ;
40
- import { getChainConfigByRentxName } from "../../../utils/assetConfigs" ;
41
- import { $exchangeRates } from "../../marketData/marketDataSlice" ;
42
- import { findExchangeRate } from "../../marketData/marketDataUtils" ;
43
- import { TransactionFees } from "../../transactions/components/TransactionFees" ;
44
- import {
45
- BookmarkPageWarning ,
46
- ProgressStatus ,
47
- } from "../../transactions/components/TransactionsHelpers" ;
48
- import {
49
- createTxQueryString ,
50
- getTxPageTitle ,
51
- TxType ,
52
- useTxParam ,
53
- } from "../../transactions/transactionsUtils" ;
54
- import {
55
- $chain ,
56
- setChain ,
57
- setWalletPickerOpened ,
58
- } from "../../wallet/walletSlice" ;
59
- import {
60
- ReleaseCompletedStatus ,
61
- ReleaseProgressStatus ,
62
- } from "../components/ReleaseStatuses" ;
63
- import {
64
- getBurnAndReleaseParams ,
65
- useBurnMachine ,
66
- useReleaseTransactionPersistence ,
67
- } from "../releaseUtils" ;
1
+ import { Divider , IconButton } from '@material-ui/core'
2
+ import { BurnMachineSchema , GatewaySession } from '@renproject/ren-tx'
3
+ import React , { FunctionComponent , useCallback , useEffect , useState , } from 'react'
4
+ import { useDispatch , useSelector } from 'react-redux'
5
+ import { RouteComponentProps , useHistory } from 'react-router-dom'
6
+ import { ActionButton , ToggleIconButton , } from '../../../components/buttons/Buttons'
7
+ import { NumberFormatText } from '../../../components/formatting/NumberFormatText'
8
+ import { BackArrowIcon } from '../../../components/icons/RenIcons'
9
+ import { CenteringSpacedBox , PaperSpacerWrapper , } from '../../../components/layout/LayoutHelpers'
10
+ import { PaperActions , PaperContent , PaperHeader , PaperNav , PaperTitle , } from '../../../components/layout/Paper'
11
+ import { LabelWithValue , SpacedDivider , } from '../../../components/typography/TypographyHelpers'
12
+ import { Debug } from '../../../components/utils/Debug'
13
+ import { WalletStatus } from '../../../components/utils/types'
14
+ import { WalletConnectionProgress } from '../../../components/wallet/WalletHelpers'
15
+ import { usePageTitle } from '../../../hooks/usePageTitle'
16
+ import { usePaperTitle } from '../../../pages/MainPage'
17
+ import { paths } from '../../../pages/routes'
18
+ import { useSelectedChainWallet } from '../../../providers/multiwallet/multiwalletHooks'
19
+ import { getChainConfigByRentxName } from '../../../utils/assetConfigs'
20
+ import { $exchangeRates } from '../../marketData/marketDataSlice'
21
+ import { findExchangeRate } from '../../marketData/marketDataUtils'
22
+ import { TransactionFees } from '../../transactions/components/TransactionFees'
23
+ import { BookmarkPageWarning , ProgressStatus , } from '../../transactions/components/TransactionsHelpers'
24
+ import { createTxQueryString , getTxPageTitle , TxType , useTxParam , } from '../../transactions/transactionsUtils'
25
+ import { $chain , setChain , setWalletPickerOpened , } from '../../wallet/walletSlice'
26
+ import { ReleaseCompletedStatus , ReleaseProgressStatus , } from '../components/ReleaseStatuses'
27
+ import { getBurnAndReleaseParams , useBurnMachine , useReleaseTransactionPersistence , } from '../releaseUtils'
68
28
69
29
export const ReleaseProcessStep : FunctionComponent < RouteComponentProps > = (
70
30
props
71
31
) => {
72
32
const { history, location } = props ;
73
- const [ paperTitle ] = usePaperTitle ( ) ;
74
-
75
33
const dispatch = useDispatch ( ) ;
76
34
const { status } = useSelectedChainWallet ( ) ;
77
35
const walletConnected = status === WalletStatus . CONNECTED ;
@@ -81,6 +39,12 @@ export const ReleaseProcessStep: FunctionComponent<RouteComponentProps> = (
81
39
const [ tx ] = useState < GatewaySession > ( parsedTx as GatewaySession ) ; // TODO Partial<GatewaySession>
82
40
83
41
usePageTitle ( getTxPageTitle ( tx ) ) ;
42
+ const [ paperTitle , setPaperTitle ] = usePaperTitle ( ) ;
43
+ useEffect ( ( ) => {
44
+ if ( ! walletConnected ) {
45
+ setPaperTitle ( "Resume Transaction" ) ;
46
+ }
47
+ } , [ walletConnected , setPaperTitle ] ) ;
84
48
85
49
const handlePreviousStepClick = useCallback ( ( ) => {
86
50
history . goBack ( ) ;
@@ -133,48 +97,52 @@ export const ReleaseProcessStep: FunctionComponent<RouteComponentProps> = (
133
97
< PaperContent bottomPadding >
134
98
{ walletConnected && < ReleaseTransactionStatus tx = { tx } /> }
135
99
{ ! walletConnected && (
136
- < BigWrapper >
137
- < MediumWrapper >
100
+ < >
101
+ < PaperSpacerWrapper >
138
102
< CenteringSpacedBox >
139
103
< WalletConnectionProgress />
140
104
</ CenteringSpacedBox >
141
- </ MediumWrapper >
105
+ </ PaperSpacerWrapper >
142
106
< ActionButton onClick = { handleWalletPickerOpen } >
143
107
Connect Wallet
144
108
</ ActionButton >
145
- </ BigWrapper >
109
+ </ >
146
110
) }
147
111
</ PaperContent >
148
- < Divider />
149
- < PaperContent topPadding bottomPadding >
150
- < LabelWithValue
151
- label = "Releasing"
152
- value = {
153
- < NumberFormatText
154
- value = { amount }
155
- spacedSuffix = { burnCurrencyConfig . short }
112
+ { walletConnected && (
113
+ < >
114
+ < Divider />
115
+ < PaperContent topPadding bottomPadding >
116
+ < LabelWithValue
117
+ label = "Releasing"
118
+ value = {
119
+ < NumberFormatText
120
+ value = { amount }
121
+ spacedSuffix = { burnCurrencyConfig . short }
122
+ />
123
+ }
124
+ valueEquivalent = {
125
+ < NumberFormatText
126
+ value = { amountUsd }
127
+ prefix = "$"
128
+ decimalScale = { 2 }
129
+ fixedDecimalScale
130
+ />
131
+ }
156
132
/>
157
- }
158
- valueEquivalent = {
159
- < NumberFormatText
160
- value = { amountUsd }
161
- prefix = "$"
162
- decimalScale = { 2 }
163
- fixedDecimalScale
133
+ < LabelWithValue label = "From" value = { burnChainConfig . full } />
134
+ < LabelWithValue label = "To" value = { tx . destAddress } />
135
+ < SpacedDivider />
136
+ < TransactionFees
137
+ chain = { chain }
138
+ amount = { amount }
139
+ currency = { burnCurrencyConfig . symbol }
140
+ type = { TxType . BURN }
164
141
/>
165
- }
166
- />
167
- < LabelWithValue label = "From" value = { burnChainConfig . full } />
168
- < LabelWithValue label = "To" value = { tx . destAddress } />
169
- < SpacedDivider />
170
- < TransactionFees
171
- chain = { chain }
172
- amount = { amount }
173
- currency = { burnCurrencyConfig . symbol }
174
- type = { TxType . BURN }
175
- />
176
- < Debug it = { { parsedTx, txState : txState } } />
177
- </ PaperContent >
142
+ < Debug it = { { parsedTx, txState : txState } } />
143
+ </ PaperContent >
144
+ </ >
145
+ ) }
178
146
{ txState ?. newTx && (
179
147
< BookmarkPageWarning onClosed = { onBookmarkWarningClosed } />
180
148
) }
0 commit comments