mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
formatting
This commit is contained in:
parent
f24472f3ed
commit
8436db69d8
@ -5,23 +5,17 @@ import { User } from '../context/User'
|
||||
|
||||
export default class Web3message extends PureComponent {
|
||||
public render() {
|
||||
// let indicatorClasses = styles.indicatorCloseEnough
|
||||
|
||||
// if (this.props.activeAccount) {
|
||||
// indicatorClasses = styles.indicatorActive
|
||||
// }
|
||||
|
||||
return (
|
||||
<>
|
||||
<User.Consumer>
|
||||
{states =>
|
||||
!states.isWeb3 ? (
|
||||
this.noWeb3()
|
||||
) : !states.isLogged ? (
|
||||
this.unlockAccount(states)
|
||||
) : states.isLogged ? (
|
||||
this.haveAccount()
|
||||
) : null
|
||||
!states.isWeb3
|
||||
? this.noWeb3()
|
||||
: !states.isLogged
|
||||
? this.unlockAccount(states)
|
||||
: states.isLogged
|
||||
? this.haveAccount()
|
||||
: null
|
||||
}
|
||||
</User.Consumer>
|
||||
</>
|
||||
@ -45,10 +39,11 @@ export default class Web3message extends PureComponent {
|
||||
public unlockAccount(states: any) {
|
||||
return (
|
||||
<div className={styles.message}>
|
||||
<span className={styles.indicatorCloseEnough} /> Account
|
||||
locked. For publishing an asset you need to unlock your Web3
|
||||
account.
|
||||
<Button link onClick={states.startLogin}>Unlock account</Button>
|
||||
<span className={styles.indicatorCloseEnough} /> Account locked.
|
||||
For publishing an asset you need to unlock your Web3 account.
|
||||
<Button link onClick={states.startLogin}>
|
||||
Unlock account
|
||||
</Button>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -56,7 +51,8 @@ export default class Web3message extends PureComponent {
|
||||
public haveAccount() {
|
||||
return (
|
||||
<div className={styles.message}>
|
||||
<span className={styles.indicatorActive} /> Connected with account
|
||||
<span className={styles.indicatorActive} /> Connected with
|
||||
account
|
||||
<span
|
||||
className={styles.account}
|
||||
title="0xfehz2u89nfewhji432ntio43huof42huifewhnuefwo"
|
||||
@ -66,5 +62,4 @@ export default class Web3message extends PureComponent {
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -144,7 +144,10 @@ class Publish extends Component<{}, PublishState> {
|
||||
)
|
||||
}
|
||||
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)
|
||||
this.setState({
|
||||
publishedDid: asset.id,
|
||||
@ -186,9 +189,7 @@ class Publish extends Component<{}, PublishState> {
|
||||
<User.Consumer>
|
||||
{states =>
|
||||
states.isLogged ? (
|
||||
<Button primary>
|
||||
Register asset
|
||||
</Button>
|
||||
<Button primary>Register asset</Button>
|
||||
) : (
|
||||
<Button onClick={states.startLogin}>
|
||||
Register asset (login first)
|
||||
@ -198,29 +199,33 @@ class Publish extends Component<{}, PublishState> {
|
||||
</User.Consumer>
|
||||
</Form>
|
||||
)}
|
||||
|
||||
</Route>
|
||||
)
|
||||
}
|
||||
|
||||
public publishingState = () => {
|
||||
return (
|
||||
<div>Please sign with your crypto wallet</div>
|
||||
)
|
||||
return <div>Please sign with your crypto wallet</div>
|
||||
}
|
||||
|
||||
public errorState = () => {
|
||||
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 = () => {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user