diff --git a/client/src/components/organisms/Web3message.module.scss b/client/src/components/organisms/Web3message.module.scss index a9df96a..af3c761 100644 --- a/client/src/components/organisms/Web3message.module.scss +++ b/client/src/components/organisms/Web3message.module.scss @@ -9,6 +9,7 @@ border-top: .1rem solid $brand-grey-lighter; padding-top: $spacer / 2; padding-bottom: $spacer / 2; + text-align: left; } .account { diff --git a/client/src/components/organisms/Web3message.tsx b/client/src/components/organisms/Web3message.tsx index 6813960..1e4bd66 100644 --- a/client/src/components/organisms/Web3message.tsx +++ b/client/src/components/organisms/Web3message.tsx @@ -5,6 +5,50 @@ import styles from './Web3message.module.scss' import { User } from '../../context/User' export default class Web3message extends PureComponent { + private noWeb3 = () => ( +
+ Not a Web3 Browser. For + publishing or downloading an asset you need to{' '} + + setup MetaMask + {' '} + or use any other Web3-capable plugin or browser. +
+ ) + + private unlockAccount = (states: any) => ( +
+ Account locked. For + publishing and downloading an asset you need to unlock your Web3 + account.{' '} + +
+ ) + + private haveAccount = (account: string) => ( +
+ Connected with account + + {`${account && account.substring(0, 20)}...`} + +
+ ) + + private wrongNetwork = (network: string) => ( +
+ Not connected to Nile + network, but to {network}.
+ Please connect in MetaMask with Custom RPC{' '} + {`https://nile.dev-ocean.com`} +
+ ) + public render() { return ( @@ -22,55 +66,4 @@ export default class Web3message extends PureComponent { ) } - - public noWeb3() { - return ( -
- Not a Web3 Browser. - For publishing or consuming an asset you need to{' '} - - setup MetaMask - {' '} - or use any other Web3-capable plugin or browser. -
- ) - } - - public unlockAccount(states: any) { - return ( -
- Account locked. For - publishing an asset you need to unlock your Web3 account.{' '} - -
- ) - } - - public haveAccount(account: string) { - return ( -
- Connected with - account - - {`${account && account.substring(0, 20)}...`} - -
- ) - } - - public wrongNetwork(network: string) { - return ( -
- Not connected to - Nile network, but to {network}.
- Please connect in MetaMask with Custom RPC{' '} - {`https://nile.dev-ocean.com`} -
- ) - } } diff --git a/client/src/routes/Details/AssetFile.tsx b/client/src/routes/Details/AssetFile.tsx index 0c0164a..e10617f 100644 --- a/client/src/routes/Details/AssetFile.tsx +++ b/client/src/routes/Details/AssetFile.tsx @@ -76,7 +76,7 @@ export default class AssetFile extends PureComponent< public render() { const { ddo, file } = this.props const { isLoading, message, error } = this.state - const { isLogged, startLogin } = this.context + const { isLogged } = this.context return (
@@ -97,11 +97,7 @@ export default class AssetFile extends PureComponent< - ) : states.isWeb3 ? ( - - ) : ( - - ) - } - - ) - - private ActionMarkup = () => ( -
- {this.state.isLoading ? ( - - ) : this.state.error ? ( -
-

{this.state.error}

- -
- ) : this.state.success ? ( -
{this.state.success}
- ) : ( - - )} - -

- You can only request Ether once every 24 hours for your address. -

-
- ) - private reset = () => { this.setState({ error: undefined, @@ -91,18 +51,57 @@ export default class Faucet extends PureComponent<{}, FaucetState> { }) } + private Success = () => ( +
{this.state.success}
+ ) + + private Error = () => ( +
+

{this.state.error}

+ +
+ ) + + private Action = () => ( + <> + +

+ You can only request Ether once every 24 hours for your address. +

+ + ) + public render() { + const { isWeb3 } = this.context + const { isLoading, error, success } = this.state + return ( - - {states => !states.isNile && } - + - +
+ {isLoading ? ( + + ) : error ? ( + + ) : success ? ( + + ) : ( + isWeb3 && + )} +
) } } + +Faucet.contextType = User