diff --git a/frontend/components/Main/MainRewards.tsx b/frontend/components/Main/MainRewards.tsx index c2bc58fe..585bf8ae 100644 --- a/frontend/components/Main/MainRewards.tsx +++ b/frontend/components/Main/MainRewards.tsx @@ -2,6 +2,7 @@ import { Button, Col, Flex, Modal, Row, Skeleton, Tag, Typography } from 'antd'; import Image from 'next/image'; import { useEffect, useState } from 'react'; import styled from 'styled-components'; +import { useTimeout } from 'usehooks-ts'; import { balanceFormat } from '@/common-util'; import { COLOR } from '@/constants'; @@ -81,15 +82,18 @@ const NotifyRewards = () => { const { totalOlasBalance } = useBalance(); const { showNotification } = useElectronApi(); - const [canShowNotification, setCanShowNotification] = useState(true); + const [canShowNotification, setCanShowNotification] = useState(false); + + useTimeout(() => setCanShowNotification(true), 1000); useEffect(() => { - // const hasAlreadyNotified = false; // TODO: Implement this once state persistence is available - // if (!isEligibleForRewards) return; - // if (hasAlreadyNotified) return; - // setCanShowNotification( - // isEligibleForRewards && !!availableRewardsForEpochEther, - // ); + // TODO: Implement this once state persistence is available + const hasAlreadyNotified = false; + + if (!isEligibleForRewards) return; + if (hasAlreadyNotified) return; + + setCanShowNotification(!!availableRewardsForEpochEther); }, [isEligibleForRewards, availableRewardsForEpochEther, showNotification]); useEffect(() => { @@ -111,14 +115,7 @@ const NotifyRewards = () => { width={400} onCancel={() => setCanShowNotification(false)} footer={[ -