index.tsx raw

   1  import { toWallet } from '@/lib/link'
   2  import { useSecondaryPage } from '@/PageManager'
   3  import { useNostr } from '@/providers/NostrProvider'
   4  import storage from '@/services/local-storage.service'
   5  import { useEffect } from 'react'
   6  import { useTranslation } from 'react-i18next'
   7  import { toast } from 'sonner'
   8  
   9  export default function CreateWalletGuideToast() {
  10    const { t } = useTranslation()
  11    const { push } = useSecondaryPage()
  12    const { profile } = useNostr()
  13  
  14    useEffect(() => {
  15      if (
  16        profile &&
  17        !profile.lightningAddress &&
  18        !storage.hasShownCreateWalletGuideToast(profile.pubkey)
  19      ) {
  20        toast(t('Set up your wallet to send and receive sats!'), {
  21          action: {
  22            label: t('Set up'),
  23            onClick: () => push(toWallet())
  24          }
  25        })
  26        storage.markCreateWalletGuideToastAsShown(profile.pubkey)
  27      }
  28    }, [profile])
  29  
  30    return null
  31  }
  32