mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
WIP
This commit is contained in:
parent
8023e30061
commit
125df58464
@ -5,12 +5,9 @@ import Footer from './components/organisms/Footer'
|
||||
import Spinner from './components/atoms/Spinner'
|
||||
import { User } from './context'
|
||||
import Routes from './Routes'
|
||||
import {commonsNetwork} from './components/molecules/NetworkSwitcher'
|
||||
import './styles/global.scss'
|
||||
import styles from './App.module.scss'
|
||||
|
||||
console.log(commonsNetwork)
|
||||
|
||||
export default class App extends Component {
|
||||
public render() {
|
||||
return (
|
||||
@ -36,5 +33,4 @@ export default class App extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
App.contextType = User
|
||||
|
@ -1,12 +1,15 @@
|
||||
import React, { useState } from 'react'
|
||||
import { CONNECTIONS } from '../../config'
|
||||
|
||||
/* TEMP NETWORK SWITCHER */
|
||||
/* NETWORK SWITCHER */
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search)
|
||||
const network = urlParams.get('network') || 'pacific'
|
||||
const idx = Object.keys(CONNECTIONS).indexOf(network)
|
||||
const commonsNetwork = Object.values(CONNECTIONS)[idx]
|
||||
const networkFromParam = urlParams.get('network') || 'pacific'
|
||||
const idx = Object.keys(CONNECTIONS).indexOf(networkFromParam)
|
||||
const commonsNetwork = Object.values(CONNECTIONS)[idx] // TypeScript won't let me access CONNECTIONS[networkFromParam] directly
|
||||
|
||||
console.log(commonsNetwork)
|
||||
|
||||
|
||||
export { commonsNetwork }
|
||||
export function NetworkSwitcher() {
|
||||
return null
|
||||
}
|
||||
|
@ -142,9 +142,7 @@ export default class AssetFile extends PureComponent<
|
||||
primary
|
||||
className={styles.buttonMain}
|
||||
// weird 0 hack so TypeScript is happy
|
||||
onClick={() =>
|
||||
this.purchaseAsset(ddo, index || 0)
|
||||
}
|
||||
onClick={() => this.purchaseAsset(ddo, index || 0)}
|
||||
disabled={!isLogged || !market.networkMatch}
|
||||
name="Download"
|
||||
>
|
||||
|
@ -8,6 +8,8 @@ import MarketProvider from './MarketProvider'
|
||||
import { MetamaskProvider } from './MetamaskProvider'
|
||||
import { BurnerWalletProvider } from './BurnerWalletProvider'
|
||||
|
||||
import { NetworkSwitcher } from '../components/molecules/NetworkSwitcher'
|
||||
|
||||
const POLL_ACCOUNTS = 1000 // every 1s
|
||||
const POLL_NETWORK = POLL_ACCOUNTS * 60 // every 1 min
|
||||
const DEFAULT_WEB3 = new Web3(new Web3.providers.HttpProvider(nodeUri)) // default web3
|
||||
@ -100,10 +102,7 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
|
||||
|
||||
private initAccountsPoll() {
|
||||
if (!this.accountsInterval) {
|
||||
this.accountsInterval = setInterval(
|
||||
this.fetchAccounts,
|
||||
POLL_ACCOUNTS
|
||||
)
|
||||
this.accountsInterval = setInterval(this.fetchAccounts, POLL_ACCOUNTS)
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,6 +225,7 @@ export default class UserProvider extends PureComponent<{}, UserProviderState> {
|
||||
return (
|
||||
<User.Provider value={this.state}>
|
||||
<MarketProvider ocean={this.state.ocean}>
|
||||
<NetworkSwitcher />
|
||||
{this.props.children}
|
||||
</MarketProvider>
|
||||
</User.Provider>
|
||||
|
@ -21,7 +21,6 @@ export { renderToDOM }
|
||||
|
||||
renderToDOM()
|
||||
|
||||
|
||||
// If you want your app to work offline and load faster, you can change
|
||||
// unregister() to register() below. Note this comes with some pitfalls.
|
||||
// Learn more about service workers: http://bit.ly/CRA-PWA
|
||||
|
@ -143,8 +143,7 @@ class Search extends PureComponent<SearchProps, SearchState> {
|
||||
{totalResults} results for{' '}
|
||||
<span>
|
||||
{decodeURIComponent(
|
||||
this.state.searchTerm ||
|
||||
this.state.searchCategories
|
||||
this.state.searchTerm || this.state.searchCategories
|
||||
)}
|
||||
</span>
|
||||
</h2>
|
||||
|
Loading…
Reference in New Issue
Block a user