2019-11-23 14:00:07 +01:00
|
|
|
import React from 'react'
|
|
|
|
import loadable from '@loadable/component'
|
2019-11-17 23:56:29 +01:00
|
|
|
import shortid from 'shortid'
|
2020-04-11 23:37:19 +02:00
|
|
|
import { Helmet } from 'react-helmet'
|
2019-11-22 21:26:50 +01:00
|
|
|
import { Web3ReactProvider } from '@web3-react/core'
|
2019-11-17 23:56:29 +01:00
|
|
|
import { Author } from '../@types/Site'
|
|
|
|
import { useSiteMetadata } from '../hooks/use-site-metadata'
|
2019-11-22 21:26:50 +01:00
|
|
|
import { getLibrary } from '../hooks/use-web3'
|
2019-11-17 23:56:29 +01:00
|
|
|
import Qr from '../components/atoms/Qr'
|
|
|
|
import Icon from '../components/atoms/Icon'
|
|
|
|
import styles from './thanks.module.scss'
|
|
|
|
|
2019-11-22 21:26:50 +01:00
|
|
|
const LazyWeb3Donation = loadable(() =>
|
2019-11-23 14:00:07 +01:00
|
|
|
import('../components/molecules/Web3Donation')
|
|
|
|
)
|
2019-11-17 23:56:29 +01:00
|
|
|
|
|
|
|
const Coin = ({ address, author }: { address: string; author: Author }) => (
|
|
|
|
<div className={styles.coin}>
|
|
|
|
<Qr title={address} address={(author as any)[address]} />
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
|
|
|
|
const BackButton = () => (
|
|
|
|
<button
|
|
|
|
className={`link ${styles.buttonBack}`}
|
|
|
|
onClick={() => window.history.back()}
|
|
|
|
>
|
|
|
|
<Icon name="ChevronLeft" /> Go Back
|
|
|
|
</button>
|
|
|
|
)
|
|
|
|
|
|
|
|
export default function Thanks() {
|
|
|
|
const { author } = useSiteMetadata()
|
|
|
|
const coins = Object.keys(author).filter(
|
2020-03-22 00:04:22 +01:00
|
|
|
(key) => key === 'bitcoin' || key === 'ether'
|
2019-11-17 23:56:29 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
return (
|
2019-11-23 18:19:41 +01:00
|
|
|
<>
|
2019-11-17 23:56:29 +01:00
|
|
|
<Helmet>
|
|
|
|
<title>Say thanks</title>
|
|
|
|
<meta name="robots" content="noindex,nofollow" />
|
|
|
|
</Helmet>
|
|
|
|
|
|
|
|
<article className={styles.thanks}>
|
|
|
|
<BackButton />
|
|
|
|
<header>
|
|
|
|
<h1 className={styles.title}>Say Thanks</h1>
|
|
|
|
</header>
|
|
|
|
|
2019-11-22 21:26:50 +01:00
|
|
|
<div className={styles.web3}>
|
|
|
|
<header>
|
|
|
|
<h4>Web3 Wallet</h4>
|
|
|
|
<p>Send Ether with MetaMask or Brave.</p>
|
|
|
|
</header>
|
2019-11-23 14:00:07 +01:00
|
|
|
|
2019-11-23 18:19:41 +01:00
|
|
|
<Web3ReactProvider getLibrary={getLibrary}>
|
|
|
|
<LazyWeb3Donation
|
|
|
|
fallback={<div className={styles.loading}>Loading...</div>}
|
|
|
|
address={author.ether}
|
|
|
|
/>
|
|
|
|
</Web3ReactProvider>
|
2019-11-22 21:26:50 +01:00
|
|
|
</div>
|
2019-11-17 23:56:29 +01:00
|
|
|
|
2019-11-22 21:26:50 +01:00
|
|
|
<div className={styles.coins}>
|
|
|
|
<header>
|
|
|
|
<h4>Any other wallets</h4>
|
|
|
|
<p>Send Bitcoin or Ether from any wallet.</p>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
{coins.map((address: string) => (
|
|
|
|
<Coin key={shortid.generate()} address={address} author={author} />
|
|
|
|
))}
|
|
|
|
</div>
|
2019-11-17 23:56:29 +01:00
|
|
|
</article>
|
2019-11-23 18:19:41 +01:00
|
|
|
</>
|
2019-11-17 23:56:29 +01:00
|
|
|
)
|
|
|
|
}
|