import React, { Children, Component } from 'react'; import { connect } from 'react-redux'; import { Progress } from 'semantic-ui-react' // CSS import '../assets/css/loading-container.css'; // Images 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 === 'initializing') { return (
ethereum_logo

Connecting to the Ethereum network...

Please make sure to unlock MetaMask.

); } if (this.props.web3.status === 'failed' || this.props.web3.networkFailed) { return (
ethereum_logo

No connection to the Ethereum network!

Please make sure that:
); } if (this.props.web3.status === 'initialized' && this.props.web3.accountsFailed) { return (
ethereum_logo

We can't find any Ethereum accounts!

Please make sure that MetaMask is unlocked.

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

Initializing contracts...

); } 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.ipfsInitialized && !this.props.ipfsFailed) { return (
ipfs_logo

Initializing IPFS...

); } if (this.props.ipfsFailed) { return (
ipfs_logo

IPFS initialization failed!

); } if (!this.props.orbitInitialized && !this.props.orbitFailed) { 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.orbitFailed) { return (
orbitdb_logo

OrbitDB initialization failed!

); } 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, ipfsFailed: state.ipfs.failed, orbitInitialized: state.orbit.initialized, orbitFailed: state.orbit.failed }); export default connect(mapStateToProps)(LoadingContainer);