@@ -66,11 +66,7 @@ import TxReadyForClaim from 'icons/TxReadyForClaim';
66
66
import { useGetRedeemTokens } from 'hooks/useGetTokens' ;
67
67
import { tokenIdFromTuple } from 'config/tokens' ;
68
68
69
- type StyleProps = {
70
- transitionDuration ?: string | undefined ;
71
- } ;
72
-
73
- const useStyles = makeStyles < StyleProps > ( ) ( ( theme , { transitionDuration } ) => ( {
69
+ const useStyles = makeStyles ( ) ( ( theme : any ) => ( {
74
70
spacer : {
75
71
display : 'flex' ,
76
72
flexDirection : 'column' ,
@@ -117,7 +113,7 @@ const useStyles = makeStyles<StyleProps>()((theme, { transitionDuration }) => ({
117
113
} ,
118
114
circularProgressCircleDeterminite : {
119
115
strokeLinecap : 'round' ,
120
- transitionDuration,
116
+ transitionDuration : '1s' ,
121
117
transitionProperty : 'all' ,
122
118
transitionTimingFunction : 'linear' ,
123
119
} ,
@@ -139,6 +135,7 @@ const useStyles = makeStyles<StyleProps>()((theme, { transitionDuration }) => ({
139
135
const Redeem = ( ) => {
140
136
const dispatch = useDispatch ( ) ;
141
137
const theme = useTheme ( ) ;
138
+ const { classes } = useStyles ( ) ;
142
139
143
140
const [ claimError , setClaimError ] = useState ( '' ) ;
144
141
const [ isClaimInProgress , setIsClaimInProgress ] = useState ( false ) ;
@@ -370,11 +367,9 @@ const Redeem = () => {
370
367
}
371
368
372
369
return 0 ;
373
- } , [ txTimestamp , eta ] ) ;
374
-
375
- const { classes } = useStyles ( {
376
- transitionDuration : `${ remainingEta } ms` ,
377
- } ) ;
370
+ // We need to update the remaining ETA every second, that's why we have seconds in the deps array
371
+ // eslint-disable-next-line react-hooks/exhaustive-deps
372
+ } , [ txTimestamp , eta , etaExpired , seconds ] ) ;
378
373
379
374
const header = useMemo ( ( ) => {
380
375
const defaults : { text : string ; align : Alignment } = {
@@ -465,23 +460,14 @@ const Redeem = () => {
465
460
// Value for determinate circular progress bar
466
461
const etaProgressValue = useMemo ( ( ) => {
467
462
if ( eta ) {
468
- if ( isRunning || remainingEta === 0 ) {
469
- // We return the full bar value when the ETA timer is running
470
- // and simulate the progress by setting transitionDuration (see useStyles above)
471
- return 100 ;
472
- }
473
-
474
- // This happens during Redeem view's initial loading before the ETA timer starts
475
- // We calculate progress bar's initial value from completed eta
476
- // This value should be between 0-100
477
463
const completedEta = eta - remainingEta ;
478
464
const percentRatio = completedEta / eta ;
479
- return Math . floor ( percentRatio * 100 ) ;
465
+ return percentRatio * 100 ; // Circular progress value range is 0-100
480
466
}
481
467
482
468
// Set initial value to zero if we don't have an ETA
483
469
return 0 ;
484
- } , [ eta , remainingEta , isRunning ] ) ;
470
+ } , [ eta , remainingEta ] ) ;
485
471
486
472
// In-progress circular progress bar
487
473
const etaCircularProgress = useMemo ( ( ) => {
@@ -778,12 +764,13 @@ const Redeem = () => {
778
764
fromChain ,
779
765
isConnectedToReceivingWallet ,
780
766
isTxDestQueued ,
767
+ receivedToken ,
781
768
receivingWallet . address ,
782
- token ,
783
769
routeContext . receipt ,
784
770
routeContext . route ,
785
771
routeName ,
786
772
toChain ,
773
+ token ,
787
774
] ) ;
788
775
789
776
// Main CTA button which has separate states for automatic and manual claims
0 commit comments