@@ -16,7 +16,6 @@ import { ServicesService } from '@/service/Services';
16
16
import { Address } from '@/types/Address' ;
17
17
18
18
import { CustomAlert } from '../Alert' ;
19
- import { FeatureNotEnabled } from '../FeatureNotEnabled' ;
20
19
21
20
const { Text } = Typography ;
22
21
@@ -76,6 +75,7 @@ export const WithdrawFunds = () => {
76
75
const { selectedService, refetch : refetchServices } = useServices ( ) ;
77
76
const { refetch : refetchMasterWallets } = useMasterWalletContext ( ) ;
78
77
const { updateBalances } = useBalanceContext ( ) ;
78
+ const isWithdrawFundsEnabled = useFeatureFlag ( 'withdraw-funds' ) ;
79
79
80
80
const { service, isServiceRunning } = useService (
81
81
selectedService ?. service_config_id ,
@@ -155,46 +155,50 @@ export const WithdrawFunds = () => {
155
155
handleCancel ,
156
156
] ) ;
157
157
158
- const withdrawAllButton = useMemo (
159
- ( ) => (
160
- < Button
161
- onClick = { showModal }
162
- block
163
- size = "large"
164
- disabled = { ! service || ! isServiceStakedForMinimumDuration }
165
- >
166
- Withdraw all funds
167
- </ Button >
168
- ) ,
169
- [ showModal , service , isServiceStakedForMinimumDuration ] ,
170
- ) ;
158
+ const withdrawAllTooltipText = useMemo ( ( ) => {
159
+ if ( ! isWithdrawFundsEnabled ) {
160
+ return 'Available soon!' ;
161
+ }
171
162
172
- const withdrawAllTooltip = useMemo ( ( ) => {
173
163
// countdown to withdrawal
174
164
if ( ! isServiceStakedForMinimumDuration ) {
175
165
return `${ minDurationMessage } ${ countdownDisplay } ` ;
176
166
}
177
167
178
168
return null ;
179
- } , [ countdownDisplay , isServiceStakedForMinimumDuration ] ) ;
169
+ } , [
170
+ countdownDisplay ,
171
+ isServiceStakedForMinimumDuration ,
172
+ isWithdrawFundsEnabled ,
173
+ ] ) ;
180
174
181
175
const modalButtonText = useMemo ( ( ) => {
182
- if ( isWithdrawalLoading ) return 'Loading' ;
176
+ if ( isWithdrawalLoading ) return 'Loading... ' ;
183
177
return 'Proceed' ;
184
178
} , [ isWithdrawalLoading ] ) ;
185
179
186
- const isWithdrawFundsEnabled = useFeatureFlag ( 'withdraw-funds' ) ;
187
- if ( ! isWithdrawFundsEnabled ) return < FeatureNotEnabled /> ;
188
-
189
180
return (
190
181
< >
191
- { withdrawAllTooltip ? (
192
- < Tooltip title = { < Text className = "text-sm" > { withdrawAllTooltip } </ Text > } >
193
- { withdrawAllButton }
194
- </ Tooltip >
195
- ) : (
196
- withdrawAllButton
197
- ) }
182
+ < Tooltip
183
+ title = {
184
+ withdrawAllTooltipText ? (
185
+ < Text className = "text-sm" > { withdrawAllTooltipText } </ Text >
186
+ ) : null
187
+ }
188
+ >
189
+ < Button
190
+ onClick = { showModal }
191
+ disabled = {
192
+ ! service ||
193
+ ! isServiceStakedForMinimumDuration ||
194
+ ! isWithdrawFundsEnabled
195
+ }
196
+ block
197
+ size = "large"
198
+ >
199
+ Withdraw all funds
200
+ </ Button >
201
+ </ Tooltip >
198
202
199
203
{ ! isServiceRunning && < ServiceNotRunning /> }
200
204
0 commit comments