Skip to content

Commit

Permalink
Fix: delay the notifications banner
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Nov 20, 2023
1 parent 0b7d378 commit 8b926e3
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import type { PushNotificationPreferences } from '@/services/push-notifications/
import type { NotifiableSafes } from '../logic'
import useWallet from '@/hooks/wallets/useWallet'
import CircularProgress from '@mui/material/CircularProgress'

import useDebounce from '@/hooks/useDebounce'
import css from './styles.module.css'

const DISMISS_PUSH_NOTIFICATIONS_KEY = 'dismissPushNotifications'
Expand Down Expand Up @@ -119,8 +119,10 @@ export const PushNotificationsBanner = ({ children }: { children: ReactElement }

const isSafeAdded = !!addedSafesOnChain?.[safeAddress]
const isSafeRegistered = getPreferences(safe.chainId, safeAddress)
const shouldShowBanner =
isNotificationFeatureEnabled && !isPushNotificationBannerDismissed && isSafeAdded && !isSafeRegistered && !!wallet
const shouldShowBanner = useDebounce(
isNotificationFeatureEnabled && !isPushNotificationBannerDismissed && isSafeAdded && !isSafeRegistered && !!wallet,
3000,
)

const { registerNotifications } = useNotificationRegistrations()

Expand Down

0 comments on commit 8b926e3

Please sign in to comment.