import React, { Children, Component } from 'react'; import { connect } from 'react-redux'; import '../assets/css/loading-container.css'; import ethereum_logo from '../assets/images/ethereum_logo.svg'; import ipfs_logo from '../assets/images/ipfs_logo.svg'; import orbitdb_logo from '../assets/images/orbitdb_logo.png'; import logo from '../assets/images/logo.png'; class LoadingContainer extends Component { render() { if (this.props.web3.status === 'failed' || !this.props.web3.networkId) { return (
ethereum_logo

This browser has no connection to the Ethereum network

Please make sure that:
  • MetaMask is unlocked and pointed to the correct network
  • The app has been granted the right to connect to your account
); } if (this.props.web3.status === 'initialized' && Object.keys(this.props.accounts).length === 0) { return (
ethereum_logo

We can't find any Ethereum accounts!

Please make sure that MetaMask is unlocked.

); } if (!this.props.contractDeployed) { return (
ethereum_logo

No contracts found on the current network!

Please make sure that you are connected to the correct network and the contracts are deployed.

); } if (!this.props.contractInitialized) { return (
ethereum_logo

Initializing contracts...

); } if (!this.props.ipfsInitialized) { return (
ipfs_logo

Initializing IPFS...

); } if (!this.props.orbitInitialized) { const message = process.env.NODE_ENV === 'development' ? 'If needed, please sign the transaction in MetaMask to create the databases.' : 'Please sign the transaction in MetaMask to create the databases.'; return (
orbitdb_logo

Preparing OrbitDB...

{message}

); } if (this.props.drizzleStatus.initialized) return Children.only(this.props.children); return (
app_logo

Loading dapp...

); } } const mapStateToProps = (state) => ({ accounts: state.accounts, drizzleStatus: state.drizzleStatus, breezeStatus: state.breezeStatus, web3: state.web3, contractInitialized: state.contracts.Forum.initialized, contractDeployed: state.contracts.Forum.deployed, ipfsInitialized: state.ipfs.initialized, orbitInitialized: state.orbit.initialized, }); export default connect(mapStateToProps)(LoadingContainer);