strike once for lurkers

This commit is contained in:
keyan 2022-10-26 11:45:16 -05:00
parent 8a9943a1af
commit 9c5937b9be
1 changed files with 12 additions and 3 deletions

View File

@ -122,9 +122,18 @@ export default function Header ({ sub }) {
if (!fired) {
const strike = useLightning()
useEffect(() => {
setTimeout(strike, randInRange(3000, 10000))
setFired(true)
}, [router.asPath])
let isMounted = true
if (!localStorage.getItem('striked')) {
setTimeout(() => {
if (isMounted) {
strike()
localStorage.setItem('striked', 'yep')
setFired(true)
}
}, randInRange(3000, 10000))
}
return () => { isMounted = false }
}, [])
}
return path !== '/login' && !path.startsWith('/invites') &&
<Button