@@ -32,6 +32,7 @@ export function BreakNotification({
32
32
33
33
useEffect ( ( ) => {
34
34
const startTime = moment ( ) ;
35
+ let timeoutId : NodeJS . Timeout ;
35
36
36
37
const tick = ( ) => {
37
38
const now = moment ( ) ;
@@ -47,10 +48,16 @@ export function BreakNotification({
47
48
return ;
48
49
}
49
50
50
- setTimeout ( tick , 100 ) ;
51
+ timeoutId = setTimeout ( tick , 100 ) ;
51
52
} ;
52
53
53
54
tick ( ) ;
55
+
56
+ return ( ) => {
57
+ if ( timeoutId ) {
58
+ clearTimeout ( timeoutId ) ;
59
+ }
60
+ } ;
54
61
} , [ onCountdownOver ] ) ;
55
62
56
63
const secondsRemaining = Math . ceil ( msRemaining / 1000 ) ;
@@ -97,16 +104,17 @@ export function BreakNotification({
97
104
< div
98
105
className = "absolute rounded-md"
99
106
style = { {
100
- top : ' -0.5px' ,
101
- right : ' -0.5px' ,
102
- bottom : ' -0.5px' ,
103
- left : ' -0.5px' ,
107
+ top : " -0.5px" ,
108
+ right : " -0.5px" ,
109
+ bottom : " -0.5px" ,
110
+ left : " -0.5px" ,
104
111
background : `conic-gradient(from 0deg at 50% 50%, ${ textColor } 0deg, ${ textColor } ${ ( progressValue / 100 ) * 360 } deg, transparent ${ ( progressValue / 100 ) * 360 } deg, transparent 360deg)` ,
105
- padding : '2.5px' ,
106
- WebkitMask : 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)' ,
107
- WebkitMaskComposite : 'xor' ,
108
- mask : 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)' ,
109
- maskComposite : 'exclude' ,
112
+ padding : "2.5px" ,
113
+ WebkitMask :
114
+ "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)" ,
115
+ WebkitMaskComposite : "xor" ,
116
+ mask : "linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)" ,
117
+ maskComposite : "exclude" ,
110
118
} }
111
119
/>
112
120
) }
0 commit comments