1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

formatting

This commit is contained in:
Matthias Kretschmann 2019-02-12 12:39:37 +01:00
parent f24472f3ed
commit 8436db69d8
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 30 additions and 30 deletions

View File

@ -5,23 +5,17 @@ import { User } from '../context/User'
export default class Web3message extends PureComponent { export default class Web3message extends PureComponent {
public render() { public render() {
// let indicatorClasses = styles.indicatorCloseEnough
// if (this.props.activeAccount) {
// indicatorClasses = styles.indicatorActive
// }
return ( return (
<> <>
<User.Consumer> <User.Consumer>
{states => {states =>
!states.isWeb3 ? ( !states.isWeb3
this.noWeb3() ? this.noWeb3()
) : !states.isLogged ? ( : !states.isLogged
this.unlockAccount(states) ? this.unlockAccount(states)
) : states.isLogged ? ( : states.isLogged
this.haveAccount() ? this.haveAccount()
) : null : null
} }
</User.Consumer> </User.Consumer>
</> </>
@ -45,10 +39,11 @@ export default class Web3message extends PureComponent {
public unlockAccount(states: any) { public unlockAccount(states: any) {
return ( return (
<div className={styles.message}> <div className={styles.message}>
<span className={styles.indicatorCloseEnough} /> Account <span className={styles.indicatorCloseEnough} /> Account locked.
locked. For publishing an asset you need to unlock your Web3 For publishing an asset you need to unlock your Web3 account.
account. <Button link onClick={states.startLogin}>
<Button link onClick={states.startLogin}>Unlock account</Button> Unlock account
</Button>
</div> </div>
) )
} }
@ -56,7 +51,8 @@ export default class Web3message extends PureComponent {
public haveAccount() { public haveAccount() {
return ( return (
<div className={styles.message}> <div className={styles.message}>
<span className={styles.indicatorActive} /> Connected with account <span className={styles.indicatorActive} /> Connected with
account
<span <span
className={styles.account} className={styles.account}
title="0xfehz2u89nfewhji432ntio43huof42huifewhnuefwo" title="0xfehz2u89nfewhji432ntio43huof42huifewhnuefwo"
@ -66,5 +62,4 @@ export default class Web3message extends PureComponent {
</div> </div>
) )
} }
} }

View File

@ -144,7 +144,10 @@ class Publish extends Component<{}, PublishState> {
) )
} }
try { try {
const asset = await this.context.ocean.registerAsset(newAsset, account[0]) const asset = await this.context.ocean.registerAsset(
newAsset,
account[0]
)
Logger.log('asset:', asset) Logger.log('asset:', asset)
this.setState({ this.setState({
publishedDid: asset.id, publishedDid: asset.id,
@ -186,9 +189,7 @@ class Publish extends Component<{}, PublishState> {
<User.Consumer> <User.Consumer>
{states => {states =>
states.isLogged ? ( states.isLogged ? (
<Button primary> <Button primary>Register asset</Button>
Register asset
</Button>
) : ( ) : (
<Button onClick={states.startLogin}> <Button onClick={states.startLogin}>
Register asset (login first) Register asset (login first)
@ -198,29 +199,33 @@ class Publish extends Component<{}, PublishState> {
</User.Consumer> </User.Consumer>
</Form> </Form>
)} )}
</Route> </Route>
) )
} }
public publishingState = () => { public publishingState = () => {
return ( return <div>Please sign with your crypto wallet</div>
<div>Please sign with your crypto wallet</div>
)
} }
public errorState = () => { public errorState = () => {
return ( return (
<div>Something went wrong, <a onClick={() => this.tryAgain()}>try again</a></div> <div>
Something went wrong,{' '}
<a onClick={() => this.tryAgain()}>try again</a>
</div>
) )
} }
public publishedState = () => { public publishedState = () => {
return ( return (
<div>Your asset is published! See it <a href={'/asset/' + this.state.publishedDid}>here</a>, submit another asset by clicking <a onClick={() => this.toStart()}>here</a></div> <div>
Your asset is published! See it{' '}
<a href={'/asset/' + this.state.publishedDid}>here</a>, submit
another asset by clicking{' '}
<a onClick={() => this.toStart()}>here</a>
</div>
) )
} }
} }
Publish.contextType = User Publish.contextType = User