mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
fixed bookmark prices
This commit is contained in:
parent
11b7146812
commit
1da3214599
@ -1,8 +1,7 @@
|
|||||||
import { useUserPreferences } from '../../providers/UserPreferences'
|
import { useUserPreferences } from '../../providers/UserPreferences'
|
||||||
import React, { ReactElement, useEffect, useState } from 'react'
|
import React, { ReactElement, useEffect, useState } from 'react'
|
||||||
import Table from '../atoms/Table'
|
import Table from '../atoms/Table'
|
||||||
import { DDO, Logger, ConfigHelperConfig } from '@oceanprotocol/lib'
|
import { DDO, Logger, BestPrice } from '@oceanprotocol/lib'
|
||||||
import { useOcean } from '../../providers/Ocean'
|
|
||||||
import Price from '../atoms/Price'
|
import Price from '../atoms/Price'
|
||||||
import Tooltip from '../atoms/Tooltip'
|
import Tooltip from '../atoms/Tooltip'
|
||||||
import AssetTitle from './AssetListTitle'
|
import AssetTitle from './AssetListTitle'
|
||||||
@ -10,6 +9,7 @@ import {
|
|||||||
queryMetadata,
|
queryMetadata,
|
||||||
transformChainIdsListToQuery
|
transformChainIdsListToQuery
|
||||||
} from '../../utils/aquarius'
|
} from '../../utils/aquarius'
|
||||||
|
import { getAssetsBestPrices, AssetListPrices } from '../../utils/subgraph'
|
||||||
import axios, { CancelToken } from 'axios'
|
import axios, { CancelToken } from 'axios'
|
||||||
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
|
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
|
||||||
|
|
||||||
@ -52,19 +52,19 @@ async function getAssetsBookmarked(
|
|||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
name: 'Data Set',
|
name: 'Data Set',
|
||||||
selector: function getAssetRow(row: DDO) {
|
selector: function getAssetRow(row: AssetListPrices) {
|
||||||
const { attributes } = row.findServiceByType('metadata')
|
const { attributes } = row.ddo.findServiceByType('metadata')
|
||||||
return <AssetTitle title={attributes.main.name} ddo={row} />
|
return <AssetTitle title={attributes.main.name} ddo={row.ddo} />
|
||||||
},
|
},
|
||||||
maxWidth: '45rem',
|
maxWidth: '45rem',
|
||||||
grow: 1
|
grow: 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Datatoken Symbol',
|
name: 'Datatoken Symbol',
|
||||||
selector: function getAssetRow(row: DDO) {
|
selector: function getAssetRow(row: AssetListPrices) {
|
||||||
return (
|
return (
|
||||||
<Tooltip content={row.dataTokenInfo.name}>
|
<Tooltip content={row.ddo.dataTokenInfo.name}>
|
||||||
{row.dataTokenInfo.symbol}
|
{row.ddo.dataTokenInfo.symbol}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@ -72,7 +72,7 @@ const columns = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Price',
|
name: 'Price',
|
||||||
selector: function getAssetRow(row: DDO) {
|
selector: function getAssetRow(row: AssetListPrices) {
|
||||||
return <Price price={row.price} small />
|
return <Price price={row.price} small />
|
||||||
},
|
},
|
||||||
right: true
|
right: true
|
||||||
@ -83,7 +83,7 @@ export default function Bookmarks(): ReactElement {
|
|||||||
const { appConfig } = useSiteMetadata()
|
const { appConfig } = useSiteMetadata()
|
||||||
const { bookmarks } = useUserPreferences()
|
const { bookmarks } = useUserPreferences()
|
||||||
|
|
||||||
const [pinned, setPinned] = useState<DDO[]>()
|
const [pinned, setPinned] = useState<AssetListPrices[]>()
|
||||||
const [isLoading, setIsLoading] = useState<boolean>()
|
const [isLoading, setIsLoading] = useState<boolean>()
|
||||||
const { chainIds } = useUserPreferences()
|
const { chainIds } = useUserPreferences()
|
||||||
|
|
||||||
@ -106,7 +106,10 @@ export default function Bookmarks(): ReactElement {
|
|||||||
chainIds,
|
chainIds,
|
||||||
source.token
|
source.token
|
||||||
)
|
)
|
||||||
setPinned(resultPinned?.results)
|
const pinnedAssets: AssetListPrices[] = await getAssetsBestPrices(
|
||||||
|
resultPinned?.results
|
||||||
|
)
|
||||||
|
setPinned(pinnedAssets)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error.message)
|
Logger.error(error.message)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user