@@ -18,12 +18,12 @@ interface TransactionStatusProps {
1818 onClose ?: ( ) => void ;
1919}
2020
21- export function TransactionStatus ( {
22- steps,
23- currentStep,
24- isVisible,
21+ export function TransactionStatus ( {
22+ steps,
23+ currentStep,
24+ isVisible,
2525 error,
26- onClose
26+ onClose
2727} : TransactionStatusProps ) {
2828 const overlayRef = useRef < HTMLDivElement > ( null ) ;
2929 const modalRef = useRef < HTMLDivElement > ( null ) ;
@@ -47,25 +47,25 @@ export function TransactionStatus({
4747 gsap . set ( stepsRef . current , { x : - 30 , opacity : 0 } ) ;
4848
4949 // Animate in
50- tl . to ( overlayRef . current , {
51- opacity : 1 ,
52- duration : 0.3 ,
53- ease : 'power2.out'
50+ tl . to ( overlayRef . current , {
51+ opacity : 1 ,
52+ duration : 0.3 ,
53+ ease : 'power2.out'
5454 } )
55- . to ( modalRef . current , {
56- scale : 1 ,
57- opacity : 1 ,
58- y : 0 ,
59- duration : 0.5 ,
60- ease : 'back.out(1.7)'
61- } , '-=0.1' )
62- . to ( stepsRef . current , {
63- x : 0 ,
64- opacity : 1 ,
65- duration : 0.4 ,
66- stagger : 0.1 ,
67- ease : 'power2.out'
68- } , '-=0.2' ) ;
55+ . to ( modalRef . current , {
56+ scale : 1 ,
57+ opacity : 1 ,
58+ y : 0 ,
59+ duration : 0.5 ,
60+ ease : 'back.out(1.7)'
61+ } , '-=0.1' )
62+ . to ( stepsRef . current , {
63+ x : 0 ,
64+ opacity : 1 ,
65+ duration : 0.4 ,
66+ stagger : 0.1 ,
67+ ease : 'power2.out'
68+ } , '-=0.2' ) ;
6969
7070 // Pulse animation for header icon
7171 if ( headerIconRef . current ) {
@@ -112,7 +112,7 @@ export function TransactionStatus({
112112 yoyo : true ,
113113 ease : 'sine.inOut'
114114 } ) ;
115-
115+
116116 // Shake the icon slightly
117117 const icon = stepEl . querySelector ( '.step-icon' ) ;
118118 if ( icon ) {
@@ -130,14 +130,14 @@ export function TransactionStatus({
130130 boxShadow : '0 0 0px rgba(59, 130, 246, 0)' ,
131131 duration : 0.3
132132 } ) ;
133-
133+
134134 // Pop effect
135- gsap . fromTo ( stepEl ,
135+ gsap . fromTo ( stepEl ,
136136 { scale : 1 } ,
137- {
138- scale : 1.05 ,
139- duration : 0.2 ,
140- yoyo : true ,
137+ {
138+ scale : 1.05 ,
139+ duration : 0.2 ,
140+ yoyo : true ,
141141 repeat : 1 ,
142142 ease : 'power2.out'
143143 }
@@ -156,7 +156,7 @@ export function TransactionStatus({
156156 // Error shake animation
157157 gsap . killTweensOf ( stepEl ) ;
158158 gsap . to ( stepEl , {
159- x : [ - 10 , 10 , - 10 , 10 , 0 ] ,
159+ x : [ - 10 , 10 , - 10 , 10 , 0 ] as any ,
160160 duration : 0.5 ,
161161 ease : 'power2.out'
162162 } ) ;
@@ -179,10 +179,10 @@ export function TransactionStatus({
179179 duration : 0.3 ,
180180 ease : 'power2.in'
181181 } )
182- . to ( overlayRef . current , {
183- opacity : 0 ,
184- duration : 0.2
185- } , '-=0.1' ) ;
182+ . to ( overlayRef . current , {
183+ opacity : 0 ,
184+ duration : 0.2
185+ } , '-=0.1' ) ;
186186 } ;
187187
188188 if ( ! isVisible ) return null ;
@@ -191,11 +191,11 @@ export function TransactionStatus({
191191 const progressPercent = Math . round ( ( completedCount / steps . length ) * 100 ) ;
192192
193193 return (
194- < div
194+ < div
195195 ref = { overlayRef }
196196 className = "fixed inset-0 z-50 flex items-center justify-center bg-ink/80 backdrop-blur-sm"
197197 >
198- < div
198+ < div
199199 ref = { modalRef }
200200 className = "bg-white rounded-2xl border-2 border-ink shadow-hard-lg w-full max-w-md mx-4 overflow-hidden"
201201 >
@@ -204,7 +204,7 @@ export function TransactionStatus({
204204 < div className = "flex items-center justify-between" >
205205 < div className = "flex items-center gap-3" >
206206 < div className = "relative w-10 h-10 flex items-center justify-center" >
207- < span
207+ < span
208208 ref = { headerIconRef }
209209 className = "material-symbols-outlined text-2xl text-accent-lime"
210210 >
@@ -228,16 +228,16 @@ export function TransactionStatus({
228228 < div >
229229 < h3 className = "font-bold uppercase tracking-wide" > Transaction Progress</ h3 >
230230 < p className = "text-xs text-gray-400" >
231- { steps . some ( s => s . status === 'active' )
232- ? 'Processing...'
231+ { steps . some ( s => s . status === 'active' )
232+ ? 'Processing...'
233233 : steps . every ( s => s . status === 'completed' )
234- ? 'Complete!'
235- : error ? 'Failed' : 'Waiting...' }
234+ ? 'Complete!'
235+ : error ? 'Failed' : 'Waiting...' }
236236 </ p >
237237 </ div >
238238 </ div >
239239 { onClose && ! steps . some ( s => s . status === 'active' ) && (
240- < button
240+ < button
241241 onClick = { handleClose }
242242 className = "p-2 hover:bg-white/10 rounded-lg transition-colors"
243243 >
@@ -252,9 +252,9 @@ export function TransactionStatus({
252252 < div className = "relative h-3 bg-gray-200 rounded-full overflow-hidden" >
253253 { /* Animated background */ }
254254 < div className = "absolute inset-0 bg-gradient-to-r from-gray-200 via-gray-100 to-gray-200 animate-pulse" />
255-
255+
256256 { /* Progress fill */ }
257- < div
257+ < div
258258 ref = { progressRef }
259259 className = "relative h-full w-0 rounded-full overflow-hidden"
260260 style = { { background : 'linear-gradient(90deg, #3B82F6, #00D68F)' } }
@@ -274,29 +274,27 @@ export function TransactionStatus({
274274 { /* Steps */ }
275275 < div className = "px-6 py-4 space-y-3" >
276276 { steps . map ( ( step , index ) => (
277- < div
277+ < div
278278 key = { step . id }
279279 ref = { el => { stepsRef . current [ index ] = el ; } }
280- className = { `flex items-start gap-3 p-3 rounded-xl border-2 transition-colors duration-300 ${
281- step . status === 'completed'
282- ? 'bg-green-50 border-green-500'
280+ className = { `flex items-start gap-3 p-3 rounded-xl border-2 transition-colors duration-300 ${ step . status === 'completed'
281+ ? 'bg-green-50 border-green-500'
283282 : step . status === 'active'
284- ? 'bg-blue-50 border-primary'
285- : step . status === 'error'
286- ? 'bg-red-50 border-red-500'
287- : 'bg-gray-50 border-gray-200'
288- } `}
283+ ? 'bg-blue-50 border-primary'
284+ : step . status === 'error'
285+ ? 'bg-red-50 border-red-500'
286+ : 'bg-gray-50 border-gray-200'
287+ } `}
289288 >
290289 { /* Step Icon */ }
291- < div className = { `step-icon shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors duration-300 ${
292- step . status === 'completed'
290+ < div className = { `step-icon shrink-0 w-8 h-8 rounded-full flex items-center justify-center transition-colors duration-300 ${ step . status === 'completed'
293291 ? 'bg-green-500 text-white'
294292 : step . status === 'active'
295- ? 'bg-primary text-white'
296- : step . status === 'error'
297- ? 'bg-red-500 text-white'
298- : 'bg-gray-300 text-gray-500'
299- } `} >
293+ ? 'bg-primary text-white'
294+ : step . status === 'error'
295+ ? 'bg-red-500 text-white'
296+ : 'bg-gray-300 text-gray-500'
297+ } `} >
300298 { step . status === 'completed' ? (
301299 < span className = "material-symbols-outlined text-lg" > check</ span >
302300 ) : step . status === 'active' ? (
@@ -310,21 +308,19 @@ export function TransactionStatus({
310308
311309 { /* Step Content */ }
312310 < div className = "flex-1 min-w-0" >
313- < p className = { `font-bold text-sm transition-colors duration-300 ${
314- step . status === 'completed'
311+ < p className = { `font-bold text-sm transition-colors duration-300 ${ step . status === 'completed'
315312 ? 'text-green-700'
316313 : step . status === 'active'
317- ? 'text-primary'
318- : step . status === 'error'
319- ? 'text-red-700'
320- : 'text-gray-500'
321- } `} >
314+ ? 'text-primary'
315+ : step . status === 'error'
316+ ? 'text-red-700'
317+ : 'text-gray-500'
318+ } `} >
322319 { step . label }
323320 </ p >
324321 { step . description && (
325- < p className = { `text-xs mt-0.5 transition-colors duration-300 ${
326- step . status === 'active' ? 'text-blue-600' : 'text-gray-500'
327- } `} >
322+ < p className = { `text-xs mt-0.5 transition-colors duration-300 ${ step . status === 'active' ? 'text-blue-600' : 'text-gray-500'
323+ } `} >
328324 { step . description }
329325 </ p >
330326 ) }
@@ -360,23 +356,22 @@ export function TransactionStatus({
360356 { /* Footer */ }
361357 < div className = "px-6 pb-5" >
362358 < div className = "flex items-center gap-2 text-xs text-gray-600 bg-gray-100 rounded-xl p-3 border border-gray-200" >
363- < span className = { `material-symbols-outlined text-base ${
364- steps . some ( s => s . status === 'active' ) ? 'animate-pulse text-primary' : ''
365- } `} >
366- { steps . every ( s => s . status === 'completed' )
367- ? 'check_circle'
368- : error
369- ? 'warning'
370- : 'info' }
359+ < span className = { `material-symbols-outlined text-base ${ steps . some ( s => s . status === 'active' ) ? 'animate-pulse text-primary' : ''
360+ } `} >
361+ { steps . every ( s => s . status === 'completed' )
362+ ? 'check_circle'
363+ : error
364+ ? 'warning'
365+ : 'info' }
371366 </ span >
372367 < span >
373- { steps . some ( s => s . status === 'active' )
368+ { steps . some ( s => s . status === 'active' )
374369 ? 'Please sign the transaction in your wallet when prompted.'
375370 : steps . every ( s => s . status === 'completed' )
376- ? 'All transactions completed successfully!'
377- : error
378- ? 'Transaction failed. Please try again.'
379- : 'Preparing transaction...' }
371+ ? 'All transactions completed successfully!'
372+ : error
373+ ? 'Transaction failed. Please try again.'
374+ : 'Preparing transaction...' }
380375 </ span >
381376 </ div >
382377 </ div >
@@ -394,8 +389,8 @@ export function useTransactionSteps(initialSteps: Omit<TransactionStep, 'status'
394389 const [ error , setError ] = useState < string | null > ( null ) ;
395390
396391 const startStep = ( stepId : string , description ?: string ) => {
397- setSteps ( prev => prev . map ( s =>
398- s . id === stepId
392+ setSteps ( prev => prev . map ( s =>
393+ s . id === stepId
399394 ? { ...s , status : 'active' as const , description : description || s . description }
400395 : s
401396 ) ) ;
@@ -407,13 +402,13 @@ export function useTransactionSteps(initialSteps: Omit<TransactionStep, 'status'
407402 } ;
408403
409404 const completeStep = ( stepId : string ) => {
410- setSteps ( prev => prev . map ( s =>
405+ setSteps ( prev => prev . map ( s =>
411406 s . id === stepId ? { ...s , status : 'completed' as const } : s
412407 ) ) ;
413408 } ;
414409
415410 const failStep = ( stepId : string , errorMessage : string ) => {
416- setSteps ( prev => prev . map ( s =>
411+ setSteps ( prev => prev . map ( s =>
417412 s . id === stepId ? { ...s , status : 'error' as const } : s
418413 ) ) ;
419414 setError ( errorMessage ) ;
0 commit comments