mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
get all screens to render again
This commit is contained in:
parent
fa5c2ed684
commit
796fc6be81
@ -1,5 +1,8 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
metadataCacheUri: 'https://aquarius.mainnet.oceanprotocol.com',
|
metadataCacheUri:
|
||||||
|
process.env.METADATACACHE_URI ||
|
||||||
|
'https://aquarius.mainnet.oceanprotocol.com',
|
||||||
|
|
||||||
// List of supported chainIds which metadata cache queries
|
// List of supported chainIds which metadata cache queries
|
||||||
// will return by default
|
// will return by default
|
||||||
chainIds: [1, 3, 4, 137, 1287],
|
chainIds: [1, 3, 4, 137, 1287],
|
||||||
|
@ -37,9 +37,9 @@ export default function AssetType({
|
|||||||
{type === 'dataset' ? 'data set' : 'algorithm'}
|
{type === 'dataset' ? 'data set' : 'algorithm'}
|
||||||
</div>
|
</div>
|
||||||
{/* TODO: networkId needs to come from the multinetwork DDO for each asset */}
|
{/* TODO: networkId needs to come from the multinetwork DDO for each asset */}
|
||||||
{config?.networkId && (
|
{(config?.networkId || 1) && (
|
||||||
<NetworkName
|
<NetworkName
|
||||||
networkId={config.networkId}
|
networkId={config?.networkId || 1}
|
||||||
className={styles.network}
|
className={styles.network}
|
||||||
minimal
|
minimal
|
||||||
/>
|
/>
|
||||||
|
@ -26,13 +26,13 @@ export default function ExplorerLink({
|
|||||||
})
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setUrl((config as ConfigHelperConfig).explorerUri)
|
setUrl((config as ConfigHelperConfig)?.explorerUri)
|
||||||
}, [config])
|
}, [config])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={`${url}/${path}`}
|
href={`${url}/${path}`}
|
||||||
title={`View on ${(config as ConfigHelperConfig).explorerUri}`}
|
title={`View on ${(config as ConfigHelperConfig)?.explorerUri}`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className={styleClasses}
|
className={styleClasses}
|
||||||
|
@ -4,7 +4,6 @@ import { useField } from 'formik'
|
|||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import FileInfo from './Info'
|
import FileInfo from './Info'
|
||||||
import FileInput from './Input'
|
import FileInput from './Input'
|
||||||
import { useOcean } from '../../../../providers/Ocean'
|
|
||||||
import { InputProps } from '../../../atoms/Input'
|
import { InputProps } from '../../../atoms/Input'
|
||||||
import { fileinfo } from '../../../../utils/provider'
|
import { fileinfo } from '../../../../utils/provider'
|
||||||
|
|
||||||
@ -12,19 +11,17 @@ export default function FilesInput(props: InputProps): ReactElement {
|
|||||||
const [field, meta, helpers] = useField(props.name)
|
const [field, meta, helpers] = useField(props.name)
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
const [fileUrl, setFileUrl] = useState<string>()
|
const [fileUrl, setFileUrl] = useState<string>()
|
||||||
const { config } = useOcean()
|
|
||||||
|
|
||||||
function loadFileInfo() {
|
function loadFileInfo() {
|
||||||
const source = axios.CancelToken.source()
|
const source = axios.CancelToken.source()
|
||||||
|
|
||||||
async function validateUrl() {
|
async function validateUrl() {
|
||||||
|
// TODO: get the providerUri
|
||||||
|
const providerUri = ''
|
||||||
|
|
||||||
try {
|
try {
|
||||||
setIsLoading(true)
|
setIsLoading(true)
|
||||||
const checkedFile = await fileinfo(
|
const checkedFile = await fileinfo(fileUrl, providerUri, source.token)
|
||||||
fileUrl,
|
|
||||||
config.providerUri,
|
|
||||||
source.token
|
|
||||||
)
|
|
||||||
checkedFile && helpers.setValue([checkedFile])
|
checkedFile && helpers.setValue([checkedFile])
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error('Could not fetch file info. Please check URL and try again')
|
toast.error('Could not fetch file info. Please check URL and try again')
|
||||||
@ -43,7 +40,7 @@ export default function FilesInput(props: InputProps): ReactElement {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
loadFileInfo()
|
loadFileInfo()
|
||||||
}, [fileUrl, config.providerUri])
|
}, [fileUrl])
|
||||||
|
|
||||||
async function handleButtonClick(e: React.SyntheticEvent, url: string) {
|
async function handleButtonClick(e: React.SyntheticEvent, url: string) {
|
||||||
// hack so the onBlur-triggered validation does not show,
|
// hack so the onBlur-triggered validation does not show,
|
||||||
|
@ -80,7 +80,7 @@ export default function AssetContent(props: AssetContentProps): ReactElement {
|
|||||||
{showPricing && <Pricing ddo={ddo} />}
|
{showPricing && <Pricing ddo={ddo} />}
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<MetaMain />
|
<MetaMain />
|
||||||
<Bookmark did={ddo.id} />
|
{/* <Bookmark did={ddo.id} /> */}
|
||||||
|
|
||||||
{isInPurgatory ? (
|
{isInPurgatory ? (
|
||||||
<Alert
|
<Alert
|
||||||
|
@ -6,10 +6,11 @@ import axios from 'axios'
|
|||||||
import { queryMetadata } from '../../../utils/aquarius'
|
import { queryMetadata } from '../../../utils/aquarius'
|
||||||
import { useWeb3 } from '../../../providers/Web3'
|
import { useWeb3 } from '../../../providers/Web3'
|
||||||
import { useOcean } from '../../../providers/Ocean'
|
import { useOcean } from '../../../providers/Ocean'
|
||||||
|
import { useSiteMetadata } from '../../../hooks/useSiteMetadata'
|
||||||
|
|
||||||
export default function PublishedList(): ReactElement {
|
export default function PublishedList(): ReactElement {
|
||||||
const { accountId } = useWeb3()
|
const { accountId } = useWeb3()
|
||||||
const { metadataCacheUri } = useOcean()
|
const { appConfig } = useSiteMetadata()
|
||||||
|
|
||||||
const [queryResult, setQueryResult] = useState<QueryResult>()
|
const [queryResult, setQueryResult] = useState<QueryResult>()
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
@ -20,6 +21,8 @@ export default function PublishedList(): ReactElement {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function getPublished() {
|
async function getPublished() {
|
||||||
if (!accountId) return
|
if (!accountId) return
|
||||||
|
|
||||||
|
// TODO: this query needs to adapt to chainIds
|
||||||
const queryPublishedAssets = {
|
const queryPublishedAssets = {
|
||||||
page: page,
|
page: page,
|
||||||
offset: 9,
|
offset: 9,
|
||||||
@ -34,7 +37,7 @@ export default function PublishedList(): ReactElement {
|
|||||||
queryResult || setIsLoading(true)
|
queryResult || setIsLoading(true)
|
||||||
const result = await queryMetadata(
|
const result = await queryMetadata(
|
||||||
queryPublishedAssets,
|
queryPublishedAssets,
|
||||||
metadataCacheUri,
|
appConfig.metadataCacheUri,
|
||||||
source.token
|
source.token
|
||||||
)
|
)
|
||||||
setQueryResult(result)
|
setQueryResult(result)
|
||||||
@ -45,7 +48,7 @@ export default function PublishedList(): ReactElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
getPublished()
|
getPublished()
|
||||||
}, [accountId, page, metadataCacheUri])
|
}, [accountId, page, appConfig.metadataCacheUri])
|
||||||
|
|
||||||
return accountId ? (
|
return accountId ? (
|
||||||
<AssetList
|
<AssetList
|
||||||
|
@ -7,16 +7,13 @@ import {
|
|||||||
SearchQuery
|
SearchQuery
|
||||||
} from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
|
} from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
|
||||||
import Container from '../atoms/Container'
|
import Container from '../atoms/Container'
|
||||||
import { useOcean } from '../../providers/Ocean'
|
|
||||||
import Button from '../atoms/Button'
|
import Button from '../atoms/Button'
|
||||||
import Bookmarks from '../molecules/Bookmarks'
|
import Bookmarks from '../molecules/Bookmarks'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { queryMetadata } from '../../utils/aquarius'
|
import { queryMetadata } from '../../utils/aquarius'
|
||||||
import { getHighestLiquidityDIDs } from '../../utils/subgraph'
|
import { getHighestLiquidityDIDs } from '../../utils/subgraph'
|
||||||
import { DDO, Logger } from '@oceanprotocol/lib'
|
import { DDO, Logger } from '@oceanprotocol/lib'
|
||||||
import { useWeb3 } from '../../providers/Web3'
|
|
||||||
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
|
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
|
||||||
import { getOceanConfig } from '../../utils/ocean'
|
|
||||||
|
|
||||||
async function getQueryHighest(
|
async function getQueryHighest(
|
||||||
chainIds: number[]
|
chainIds: number[]
|
||||||
|
@ -22,6 +22,7 @@ import { useAsset } from './Asset'
|
|||||||
interface OceanProviderValue {
|
interface OceanProviderValue {
|
||||||
ocean: Ocean
|
ocean: Ocean
|
||||||
account: Account
|
account: Account
|
||||||
|
config: Config
|
||||||
connect: (config: Config) => Promise<void>
|
connect: (config: Config) => Promise<void>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ function OceanProvider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
|
|
||||||
const [ocean, setOcean] = useState<Ocean>()
|
const [ocean, setOcean] = useState<Ocean>()
|
||||||
const [account, setAccount] = useState<Account>()
|
const [account, setAccount] = useState<Account>()
|
||||||
|
const [config, setConfig] = useState<Config>()
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
// Helper: Create Ocean instance
|
// Helper: Create Ocean instance
|
||||||
@ -50,6 +52,7 @@ function OceanProvider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
Logger.log('[ocean] Connecting Ocean...', newConfig)
|
Logger.log('[ocean] Connecting Ocean...', newConfig)
|
||||||
const newOcean = await Ocean.getInstance(newConfig)
|
const newOcean = await Ocean.getInstance(newConfig)
|
||||||
setOcean(newOcean)
|
setOcean(newOcean)
|
||||||
|
setConfig(newConfig)
|
||||||
Logger.log('[ocean] Ocean instance created.', newOcean)
|
Logger.log('[ocean] Ocean instance created.', newOcean)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error('[ocean] Error: ', error.message)
|
Logger.error('[ocean] Error: ', error.message)
|
||||||
@ -99,7 +102,8 @@ function OceanProvider({ children }: { children: ReactNode }): ReactElement {
|
|||||||
{
|
{
|
||||||
ocean,
|
ocean,
|
||||||
account,
|
account,
|
||||||
connect
|
connect,
|
||||||
|
config
|
||||||
// refreshBalance
|
// refreshBalance
|
||||||
} as OceanProviderValue
|
} as OceanProviderValue
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user