kremalicious/blog

View on GitHub
src/features/Web3/components/Success/Success.tsx

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { $isInitSend } from '@/features/Web3/stores'
import { useAccount } from 'wagmi'
import { ExplorerLink } from './ExplorerLink'
import styles from './Success.module.css'

const title = `You're amazing, thanks!`
const description =
  'Your transaction is on its way. You can check the status on'

export function Success() {
  const account = useAccount()

  const explorerName = account?.chain?.blockExplorers?.default.name
  const explorerUrl = account?.chain?.blockExplorers?.default.url

  return (
    <div className={styles.success}>
      <h5 className={styles.title}>{title}</h5>

      <p>
        {description}{' '}
        <ExplorerLink url={explorerUrl}>{explorerName}</ExplorerLink>.
      </p>

      <footer className={styles.actions}>
        <button
          type="button"
          onClick={() => $isInitSend.set(false)}
          className="btn btn-primary"
        >
          Close
        </button>
      </footer>
    </div>
  )
}