From 38da4864197f9a388cc7d3b82b89fc2b4a5e6939 Mon Sep 17 00:00:00 2001 From: doobry Date: Sun, 28 Apr 2024 13:49:39 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Automatically=20dismiss=20reload?= =?UTF-8?q?=20info=20message=20after=2010=20seconds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ReloadInfo.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/ReloadInfo.tsx b/src/components/ReloadInfo.tsx index dc960da..368ff7a 100644 --- a/src/components/ReloadInfo.tsx +++ b/src/components/ReloadInfo.tsx @@ -1,4 +1,4 @@ -import { FC, useCallback, useState } from 'react' +import { FC, useCallback, useEffect, useState } from 'react' import { Message } from 'semantic-ui-react' const ReloadInfo: FC = () => { @@ -9,6 +9,13 @@ const ReloadInfo: FC = () => { localStorage.setItem('showReloadInfo', '0') }, []) + useEffect(() => { + const timeoutId = setTimeout(() => { + setShowReloadInfo(false) + }, 10000) + return () => clearTimeout(timeoutId) + }, []) + return (