Skip to content

Commit 3457df6

Browse files
Fix duplicate UI in notification window
1 parent 3437c99 commit 3457df6

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

app/renderer/components/break/break-notification.tsx

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export function BreakNotification({
3232

3333
useEffect(() => {
3434
const startTime = moment();
35+
let timeoutId: NodeJS.Timeout;
3536

3637
const tick = () => {
3738
const now = moment();
@@ -47,10 +48,16 @@ export function BreakNotification({
4748
return;
4849
}
4950

50-
setTimeout(tick, 100);
51+
timeoutId = setTimeout(tick, 100);
5152
};
5253

5354
tick();
55+
56+
return () => {
57+
if (timeoutId) {
58+
clearTimeout(timeoutId);
59+
}
60+
};
5461
}, [onCountdownOver]);
5562

5663
const secondsRemaining = Math.ceil(msRemaining / 1000);
@@ -97,16 +104,17 @@ export function BreakNotification({
97104
<div
98105
className="absolute rounded-md"
99106
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",
104111
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",
110118
}}
111119
/>
112120
)}

0 commit comments

Comments
 (0)