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

warning fixes, fix compile error

This commit is contained in:
Jernej Pregelj 2019-02-07 11:58:08 +01:00
parent 9bdcf8fb6b
commit 7e4425b5df
7 changed files with 191 additions and 321 deletions

354
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@
"dependencies": { "dependencies": {
"@oceanprotocol/squid": "^0.2.8", "@oceanprotocol/squid": "^0.2.8",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"eslint": "^5.6.0",
"query-string": "^6.2.0", "query-string": "^6.2.0",
"react": "^16.8.1", "react": "^16.8.1",
"react-dom": "^16.8.1", "react-dom": "^16.8.1",

View File

@ -52,16 +52,16 @@ class App extends Component<{}, AppState> {
if (accounts.length === 0 && (window as any).ethereum) { if (accounts.length === 0 && (window as any).ethereum) {
await (window as any).ethereum.enable() await (window as any).ethereum.enable()
const { ocean } = await provideOcean() const { ocean } = await provideOcean()
this.setState(state => ({ this.setState({
isLogged: true, isLogged: true,
web3, web3,
ocean ocean
})) })
} else { } else {
this.setState(state => ({ this.setState({
isLogged: true, isLogged: true,
web3 web3
})) })
} }
} catch (e) { } catch (e) {
this.setDefaultProvider() this.setDefaultProvider()
@ -78,11 +78,11 @@ class App extends Component<{}, AppState> {
const accounts = await web3.eth.getAccounts() const accounts = await web3.eth.getAccounts()
if (accounts.length > 0) { if (accounts.length > 0) {
const { ocean } = await provideOcean() const { ocean } = await provideOcean()
this.setState(state => ({ this.setState({
isLogged: true, isLogged: true,
web3, web3,
ocean ocean
})) })
} }
} catch (e) { } catch (e) {
this.setDefaultProvider() this.setDefaultProvider()
@ -93,14 +93,14 @@ class App extends Component<{}, AppState> {
} }
private setDefaultProvider = () => { private setDefaultProvider = () => {
this.setState(state => ({ this.setState({
isLogged: false, isLogged: false,
web3: new Web3( web3: new Web3(
new Web3.providers.HttpProvider( new Web3.providers.HttpProvider(
`${nodeScheme}://${nodeHost}:${nodePort}` `${nodeScheme}://${nodeHost}:${nodePort}`
) )
) )
})) })
} }
} }

View File

@ -1,8 +1,7 @@
{ {
"title": "A cool form title", "title": "A cool form title",
"description": "A cool form description", "description": "A cool form description",
"fields": [ "fields": {
{
"name": { "name": {
"label": "Your name", "label": "Your name",
"placeholder": "i.e. Jelly McJellyfish", "placeholder": "i.e. Jelly McJellyfish",
@ -67,5 +66,4 @@
] ]
} }
} }
]
} }

View File

@ -282,7 +282,7 @@ class Publish extends Component<{}, PublishState> {
) )
} }
const ddo = await this.context.ocean.registerAsset(newAsset, account[0]) await this.context.ocean.registerAsset(newAsset, account[0])
} }
} }

View File

@ -29,7 +29,7 @@ class Search extends Component<SearchProps, SearchState> {
} }
} }
const assets = await ocean.searchAssets(queryRequest) const assets = await ocean.searchAssets(queryRequest)
this.setState(state => ({ results: assets })) this.setState({ results: assets })
} }
public render() { public render() {

View File

@ -7,8 +7,8 @@ import styles from './Styleguide.module.scss'
import form from '../data/form-styleguide.json' import form from '../data/form-styleguide.json'
class Styleguide extends Component { class Styleguide extends Component {
public formFields = () => public formFields = (entries: any[]) =>
Object.entries(form.fields).map(([key, value]) => ( entries.map(([key, value]) => (
<Input <Input
key={key} key={key}
name={key} name={key}
@ -22,6 +22,7 @@ class Styleguide extends Component {
)) ))
public render() { public render() {
const entries = Object.entries(form.fields)
return ( return (
<div className={styles.page}> <div className={styles.page}>
<h1>Styleguide</h1> <h1>Styleguide</h1>
@ -33,7 +34,7 @@ class Styleguide extends Component {
</Button> </Button>
<Form title={form.title} description={form.description}> <Form title={form.title} description={form.description}>
{this.formFields} {this.formFields(entries)}
</Form> </Form>
</div> </div>
) )