@@ -10,7 +10,7 @@ import { VerificationModal } from "@/ui/common/components/Modals/VerificationMod
10
10
import { FinalityProviderLogo } from "@/ui/common/components/Staking/FinalityProviders/FinalityProviderLogo" ;
11
11
import { getNetworkConfigBBN } from "@/ui/common/config/network/bbn" ;
12
12
import { getNetworkConfigBTC } from "@/ui/common/config/network/btc" ;
13
- import { chainLogos } from "@/ui/common/constants" ;
13
+ import { BaseStakingStep , chainLogos , EOIStep } from "@/ui/common/constants" ;
14
14
import { useNetworkInfo } from "@/ui/common/hooks/client/api/useNetworkInfo" ;
15
15
import { usePrice } from "@/ui/common/hooks/client/api/usePrices" ;
16
16
import { useStakingExpansionService } from "@/ui/common/hooks/services/useStakingExpansionService" ;
@@ -33,17 +33,18 @@ import { SignDetailsModal } from "../Modals/SignDetailsModal";
33
33
34
34
import { RenewTimelockModal } from "./RenewTimelockModal" ;
35
35
import { StakingExpansionModal } from "./StakingExpansionModal" ;
36
+ import { VerifiedStakeExpansionModal } from "./VerifiedStakeExpansionModal" ;
36
37
37
- const EOI_INDEXES : Record < string , number > = {
38
- "eoi-staking-slashing" : 1 ,
39
- "eoi-unbonding-slashing" : 2 ,
40
- "eoi-proof-of-possession" : 3 ,
41
- "eoi-sign-bbn" : 4 ,
38
+ const EOI_STEP_INDEXES : Record < string , number > = {
39
+ [ EOIStep . EOI_STAKING_SLASHING ] : 1 ,
40
+ [ EOIStep . EOI_UNBONDING_SLASHING ] : 2 ,
41
+ [ EOIStep . EOI_PROOF_OF_POSSESSION ] : 3 ,
42
+ [ EOIStep . EOI_SIGN_BBN ] : 4 ,
42
43
} ;
43
44
44
- const VERIFICATION_STEPS : Record < string , 1 | 2 > = {
45
- "eoi-send-bbn" : 1 ,
46
- verifying : 2 ,
45
+ const VERIFICATION_STEP_INDEXES : Record < string , 1 | 2 > = {
46
+ [ EOIStep . EOI_SEND_BBN ] : 1 ,
47
+ [ BaseStakingStep . VERIFYING ] : 2 ,
47
48
} ;
48
49
49
50
const { chainId : BBN_CHAIN_ID } = getNetworkConfigBBN ( ) ;
@@ -57,6 +58,8 @@ function StakingExpansionModalSystemInner() {
57
58
verifiedDelegation,
58
59
reset : resetState ,
59
60
expansionStepOptions,
61
+ verifiedExpansionModalOpen,
62
+ setVerifiedExpansionModalOpen,
60
63
} = useStakingExpansionState ( ) ;
61
64
62
65
const { getRegisteredFinalityProvider } = useFinalityProviderState ( ) ;
@@ -232,76 +235,88 @@ function StakingExpansionModalSystemInner() {
232
235
btcInUsd ,
233
236
] ) ;
234
237
235
- if ( ! step ) {
236
- return null ;
237
- }
238
-
239
238
const handleClose = ( ) => {
240
239
resetState ( ) ;
241
240
setDelegationV2StepOptions ?.( undefined ) ;
242
241
} ;
243
242
243
+ const handleCloseVerifiedModal = ( ) => {
244
+ setVerifiedExpansionModalOpen ( false ) ;
245
+ } ;
246
+
244
247
return (
245
248
< >
246
- { step === StakingExpansionStep . BSN_FP_SELECTION && (
247
- < StakingExpansionModal open onClose = { handleClose } />
248
- ) }
249
- { step === StakingExpansionStep . RENEWAL_TIMELOCK && (
250
- < RenewTimelockModal open onClose = { handleClose } />
251
- ) }
252
- { step === StakingExpansionStep . PREVIEW && formData && details && (
253
- < PreviewMultistakingModal
254
- open
255
- processing = { processing }
256
- bsns = { bsnInfos }
257
- finalityProviders = { finalityProviderInfos }
258
- details = { details }
259
- isExpansion = { true }
260
- onClose = { handleClose }
261
- onProceed = { async ( ) => {
262
- await createExpansionEOI ( formData ) ;
263
- resetForm ( ) ;
264
- revalidateForm ( ) ;
265
- } }
266
- />
267
- ) }
268
- { Boolean ( EOI_INDEXES [ step ] ) && (
269
- < SignModal
270
- open
271
- processing = { processing }
272
- step = { EOI_INDEXES [ step ] }
273
- title = "Staking Expansion"
274
- options = { expansionStepOptions }
275
- />
276
- ) }
277
- { Boolean ( VERIFICATION_STEPS [ step ] ) && (
278
- < VerificationModal
279
- open
280
- processing = { processing }
281
- step = { VERIFICATION_STEPS [ step ] }
282
- />
283
- ) }
284
- { verifiedDelegation && (
285
- < StakeModal
286
- open = { step === StakingExpansionStep . VERIFIED }
287
- processing = { processing }
288
- onSubmit = { ( ) => stakeDelegationExpansion ( verifiedDelegation ) }
289
- onClose = { handleClose }
290
- />
249
+ { /* Step-based modals - only render when there's an active step */ }
250
+ { step && (
251
+ < >
252
+ { step === StakingExpansionStep . BSN_FP_SELECTION && (
253
+ < StakingExpansionModal open onClose = { handleClose } />
254
+ ) }
255
+ { step === StakingExpansionStep . RENEWAL_TIMELOCK && (
256
+ < RenewTimelockModal open onClose = { handleClose } />
257
+ ) }
258
+ { step === StakingExpansionStep . PREVIEW && formData && details && (
259
+ < PreviewMultistakingModal
260
+ open
261
+ processing = { processing }
262
+ bsns = { bsnInfos }
263
+ finalityProviders = { finalityProviderInfos }
264
+ details = { details }
265
+ isExpansion = { true }
266
+ onClose = { handleClose }
267
+ onProceed = { async ( ) => {
268
+ await createExpansionEOI ( formData ) ;
269
+ resetForm ( ) ;
270
+ revalidateForm ( ) ;
271
+ } }
272
+ />
273
+ ) }
274
+ { Boolean ( EOI_STEP_INDEXES [ step ] ) && (
275
+ < SignModal
276
+ open
277
+ processing = { processing }
278
+ step = { EOI_STEP_INDEXES [ step ] }
279
+ title = "Staking Expansion"
280
+ options = { expansionStepOptions }
281
+ />
282
+ ) }
283
+ { Boolean ( VERIFICATION_STEP_INDEXES [ step ] ) && (
284
+ < VerificationModal
285
+ open
286
+ processing = { processing }
287
+ step = { VERIFICATION_STEP_INDEXES [ step ] }
288
+ />
289
+ ) }
290
+ { verifiedDelegation && (
291
+ < StakeModal
292
+ open = { step === StakingExpansionStep . VERIFIED }
293
+ processing = { processing }
294
+ onSubmit = { ( ) => stakeDelegationExpansion ( verifiedDelegation ) }
295
+ onClose = { handleClose }
296
+ />
297
+ ) }
298
+ < SuccessFeedbackModal
299
+ open = { step === StakingExpansionStep . FEEDBACK_SUCCESS }
300
+ onClose = { handleClose }
301
+ />
302
+ < CancelFeedbackModal
303
+ open = { step === StakingExpansionStep . FEEDBACK_CANCEL }
304
+ onClose = { handleClose }
305
+ />
306
+ < SignDetailsModal
307
+ open = { Boolean ( delegationV2StepOptions ) && processing }
308
+ onClose = { ( ) => setDelegationV2StepOptions ?.( undefined ) }
309
+ details = { delegationV2StepOptions }
310
+ title = { detailsModalTitle }
311
+ />
312
+ </ >
291
313
) }
292
- < SuccessFeedbackModal
293
- open = { step === StakingExpansionStep . FEEDBACK_SUCCESS }
294
- onClose = { handleClose }
295
- />
296
- < CancelFeedbackModal
297
- open = { step === StakingExpansionStep . FEEDBACK_CANCEL }
298
- onClose = { handleClose }
299
- />
300
- < SignDetailsModal
301
- open = { Boolean ( delegationV2StepOptions ) && processing }
302
- onClose = { ( ) => setDelegationV2StepOptions ?.( undefined ) }
303
- details = { delegationV2StepOptions }
304
- title = { detailsModalTitle }
314
+
315
+ { /* Independent modals - render regardless of step */ }
316
+ < VerifiedStakeExpansionModal
317
+ open = { verifiedExpansionModalOpen }
318
+ onClose = { handleCloseVerifiedModal }
319
+ processing = { processing }
305
320
/>
306
321
</ >
307
322
) ;
0 commit comments