Skip to content

Commit

Permalink
Merge pull request #572 from systemli/feat/auto_dismiss_reload_info
Browse files Browse the repository at this point in the history
πŸ’„ Automatically dismiss reload info message after 10 seconds
  • Loading branch information
doobry-systemli authored Apr 28, 2024
2 parents e5d1d66 + 38da486 commit ee78eb5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/ReloadInfo.tsx
Original file line number Diff line number Diff line change
@@ -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 = () => {
Expand All @@ -9,6 +9,13 @@ const ReloadInfo: FC = () => {
localStorage.setItem('showReloadInfo', '0')
}, [])

useEffect(() => {
const timeoutId = setTimeout(() => {
setShowReloadInfo(false)
}, 10000)
return () => clearTimeout(timeoutId)
}, [])

return (
<Message
color="teal"
Expand Down

0 comments on commit ee78eb5

Please sign in to comment.