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": {
"@oceanprotocol/squid": "^0.2.8",
"classnames": "^2.2.6",
"eslint": "^5.6.0",
"query-string": "^6.2.0",
"react": "^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) {
await (window as any).ethereum.enable()
const { ocean } = await provideOcean()
this.setState(state => ({
this.setState({
isLogged: true,
web3,
ocean
}))
})
} else {
this.setState(state => ({
this.setState({
isLogged: true,
web3
}))
})
}
} catch (e) {
this.setDefaultProvider()
@ -78,11 +78,11 @@ class App extends Component<{}, AppState> {
const accounts = await web3.eth.getAccounts()
if (accounts.length > 0) {
const { ocean } = await provideOcean()
this.setState(state => ({
this.setState({
isLogged: true,
web3,
ocean
}))
})
}
} catch (e) {
this.setDefaultProvider()
@ -93,14 +93,14 @@ class App extends Component<{}, AppState> {
}
private setDefaultProvider = () => {
this.setState(state => ({
this.setState({
isLogged: false,
web3: new Web3(
new Web3.providers.HttpProvider(
`${nodeScheme}://${nodeHost}:${nodePort}`
)
)
}))
})
}
}

View File

@ -1,71 +1,69 @@
{
"title": "A cool form title",
"description": "A cool form description",
"fields": [
{
"name": {
"label": "Your name",
"placeholder": "i.e. Jelly McJellyfish",
"type": "text",
"required": true
},
"email": {
"label": "Your email",
"placeholder": "i.e. jelly@mcjellyfish.com",
"type": "email",
"required": true
},
"message": {
"label": "Your message",
"placeholder": "i.e. jelly@mcjellyfish.com",
"tag": "textarea",
"required": true
},
"about": {
"label": "About you",
"type": "radio",
"required": true,
"options": [
{
"value": "provider",
"label": "I can provide data"
},
{
"value": "consumer",
"label": "I want to use data"
}
]
},
"about2": {
"label": "About you",
"type": "checkbox",
"required": true,
"options": [
{
"value": "provider2",
"label": "I can provide data"
},
{
"value": "consumer2",
"label": "I want to use data"
}
]
},
"industry": {
"label": "Industry",
"tag": "select",
"required": true,
"options": [
{
"value": "automotive",
"label": "Automotive"
},
{
"value": "technology",
"label": "Technology"
}
]
}
"fields": {
"name": {
"label": "Your name",
"placeholder": "i.e. Jelly McJellyfish",
"type": "text",
"required": true
},
"email": {
"label": "Your email",
"placeholder": "i.e. jelly@mcjellyfish.com",
"type": "email",
"required": true
},
"message": {
"label": "Your message",
"placeholder": "i.e. jelly@mcjellyfish.com",
"tag": "textarea",
"required": true
},
"about": {
"label": "About you",
"type": "radio",
"required": true,
"options": [
{
"value": "provider",
"label": "I can provide data"
},
{
"value": "consumer",
"label": "I want to use data"
}
]
},
"about2": {
"label": "About you",
"type": "checkbox",
"required": true,
"options": [
{
"value": "provider2",
"label": "I can provide data"
},
{
"value": "consumer2",
"label": "I want to use data"
}
]
},
"industry": {
"label": "Industry",
"tag": "select",
"required": true,
"options": [
{
"value": "automotive",
"label": "Automotive"
},
{
"value": "technology",
"label": "Technology"
}
]
}
]
}
}

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)
this.setState(state => ({ results: assets }))
this.setState({ results: assets })
}
public render() {

View File

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