diff --git a/app/hooks/notification.tsx b/app/hooks/notification.tsx index 080650d..ae00c44 100644 --- a/app/hooks/notification.tsx +++ b/app/hooks/notification.tsx @@ -23,22 +23,19 @@ export function NotificationProvider({ children }: PropsWithChildren) { const [popupShowed, setPopupShowed] = useState(false); const notify = (newNotification: NotificationType, timeout: number) => { - console.log("Changed notification"); setNotification(newNotification); setNotificationTimeout(timeout); }; useEffect(() => { - if (!popupShowed && notification !== null) { - console.log("setting timeout") + if (notification === null) { + setPopupShowed(false); + } else if (!popupShowed && notificationTimeout !== Infinity) { const timeout = setTimeout(() => { - console.log("timeout done") setPopupShowed(true); setNotification(null); }, notificationTimeout); return () => clearTimeout(timeout); - } else { - setPopupShowed(false); } }, [notification, notificationTimeout]);