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)
useEffect(() => {
if (user) {
const bonusChecker = setInterval(() => {
requestBonuses({}).catch(console.log)
return () => {
clearInterval(bonusChecker)
}
}, 1000 * 65)
}
}, [user])
if (
privateUser &&
privateUser.lastTimeCheckedBonuses &&
Date.now() - privateUser.lastTimeCheckedBonuses > 1000 * 70
)
requestBonuses({}).catch(console.log)
}, [privateUser])
return (
<Row className={clsx('justify-center')}>

View File

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