diff --git a/src/components/Web3Donation/Alerts.jsx b/src/components/Web3Donation/Alerts.jsx
index 84ffd6f6..edcb4308 100644
--- a/src/components/Web3Donation/Alerts.jsx
+++ b/src/components/Web3Donation/Alerts.jsx
@@ -1,62 +1,68 @@
-import React, { Fragment } from 'react'
+import React, { Fragment, PureComponent } from 'react'
import PropTypes from 'prop-types'
import styles from './Alerts.module.scss'
-const alertMessages = (networkName, transactionHash) => ({
- noAccount:
- 'Web3 detected, but no account. Are you logged into your MetaMask account?',
- noCorrectNetwork: `Please connect to Main network. You are on ${networkName} right now.`,
- noWeb3:
- 'No Web3 detected. Install MetaMask, Brave, or Mist.',
- success: `You are awesome, thanks!
-
- See your transaction on etherscan.io.
- `
-})
+const Message = ({ message, ...props }) => (
+
+)
-const Alerts = ({
- hasCorrectNetwork,
- hasAccount,
- networkName,
- error,
- transactionHash,
- web3Connected
-}) => {
- return !web3Connected ? (
-
- ) : (
-
+export default class Alerts extends PureComponent {
+ static propTypes = {
+ hasCorrectNetwork: PropTypes.bool,
+ hasAccount: PropTypes.bool,
+ networkName: PropTypes.string,
+ error: PropTypes.object,
+ transactionHash: PropTypes.string,
+ web3Connected: PropTypes.bool
+ }
+
+ alertMessages = (networkName, transactionHash) => ({
+ noAccount:
+ 'Web3 detected, but no account. Are you logged into your MetaMask account?',
+ noCorrectNetwork: `Please connect to Main network. You are on ${networkName} right now.`,
+ noWeb3:
+ 'No Web3 detected. Install MetaMask, Brave, or Mist.',
+ success: `You are awesome, thanks!
+
+ See your transaction on etherscan.io.
+ `
+ })
+
+ render() {
+ const {
+ hasCorrectNetwork,
+ hasAccount,
+ networkName,
+ error,
+ transactionHash,
+ web3Connected
+ } = this.props
+
+ return (
- {!hasAccount &&
{alertMessages().noaccount}
}
- {!hasCorrectNetwork && (
-
+ {!web3Connected ? (
+
+ ) : (
+
+ {!hasAccount && (
+
+ )}
+ {!hasCorrectNetwork && (
+
+ )}
+ {error && }
+
+ {transactionHash && (
+
+ )}
+
)}
- {error &&
{error.message}
}
-
- {transactionHash && (
-
- )}
-
- )
+ )
+ }
}
-
-Alerts.propTypes = {
- hasCorrectNetwork: PropTypes.bool,
- hasAccount: PropTypes.bool,
- networkName: PropTypes.string,
- error: PropTypes.object,
- transactionHash: PropTypes.string,
- web3Connected: PropTypes.bool
-}
-
-export default Alerts