Don't use interval

This commit is contained in:
Ian Philips 2022-07-07 10:10:41 -06:00
parent 8be20a753a
commit 4723edb1b8
2 changed files with 16 additions and 13 deletions

View File

@ -14,15 +14,13 @@ export default function NotificationsIcon(props: { className?: string }) {
const privateUser = usePrivateUser(user?.id) const privateUser = usePrivateUser(user?.id)
useEffect(() => { useEffect(() => {
if (user) { if (
const bonusChecker = setInterval(() => { privateUser &&
requestBonuses({}).catch(console.log) privateUser.lastTimeCheckedBonuses &&
return () => { Date.now() - privateUser.lastTimeCheckedBonuses > 1000 * 70
clearInterval(bonusChecker) )
} requestBonuses({}).catch(console.log)
}, 1000 * 65) }, [privateUser])
}
}, [user])
return ( return (
<Row className={clsx('justify-center')}> <Row className={clsx('justify-center')}>

View File

@ -102,9 +102,14 @@ function NotificationsList(props: { privateUser: PrivateUser }) {
if (!paginatedGroupedNotifications) return <LoadingIndicator /> if (!paginatedGroupedNotifications) return <LoadingIndicator />
return ( return (
<Col className={'min-h-screen'}> <div className={'min-h-[100vh]'}>
{paginatedGroupedNotifications.length === 0 && {paginatedGroupedNotifications.length === 0 && (
"You don't have any notifications. Try changing your settings to see more."} <div className={'mt-2'}>
You don't have any notifications. Try changing your settings to see
more.
</div>
)}
{paginatedGroupedNotifications.map((notification) => {paginatedGroupedNotifications.map((notification) =>
notification.type === 'income' ? ( notification.type === 'income' ? (
<IncomeNotificationGroupItem <IncomeNotificationGroupItem
@ -168,7 +173,7 @@ function NotificationsList(props: { privateUser: PrivateUser }) {
</div> </div>
</nav> </nav>
)} )}
</Col> </div>
) )
} }