1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-28 16:47:52 +02:00

fixed bookmark prices

This commit is contained in:
Bogdan Fazakas 2021-07-12 11:35:12 +03:00
parent 11b7146812
commit 1da3214599

View File

@ -1,8 +1,7 @@
import { useUserPreferences } from '../../providers/UserPreferences'
import React, { ReactElement, useEffect, useState } from 'react'
import Table from '../atoms/Table'
import { DDO, Logger, ConfigHelperConfig } from '@oceanprotocol/lib'
import { useOcean } from '../../providers/Ocean'
import { DDO, Logger, BestPrice } from '@oceanprotocol/lib'
import Price from '../atoms/Price'
import Tooltip from '../atoms/Tooltip'
import AssetTitle from './AssetListTitle'
@ -10,6 +9,7 @@ import {
queryMetadata,
transformChainIdsListToQuery
} from '../../utils/aquarius'
import { getAssetsBestPrices, AssetListPrices } from '../../utils/subgraph'
import axios, { CancelToken } from 'axios'
import { useSiteMetadata } from '../../hooks/useSiteMetadata'
@ -52,19 +52,19 @@ async function getAssetsBookmarked(
const columns = [
{
name: 'Data Set',
selector: function getAssetRow(row: DDO) {
const { attributes } = row.findServiceByType('metadata')
return <AssetTitle title={attributes.main.name} ddo={row} />
selector: function getAssetRow(row: AssetListPrices) {
const { attributes } = row.ddo.findServiceByType('metadata')
return <AssetTitle title={attributes.main.name} ddo={row.ddo} />
},
maxWidth: '45rem',
grow: 1
},
{
name: 'Datatoken Symbol',
selector: function getAssetRow(row: DDO) {
selector: function getAssetRow(row: AssetListPrices) {
return (
<Tooltip content={row.dataTokenInfo.name}>
{row.dataTokenInfo.symbol}
<Tooltip content={row.ddo.dataTokenInfo.name}>
{row.ddo.dataTokenInfo.symbol}
</Tooltip>
)
},
@ -72,7 +72,7 @@ const columns = [
},
{
name: 'Price',
selector: function getAssetRow(row: DDO) {
selector: function getAssetRow(row: AssetListPrices) {
return <Price price={row.price} small />
},
right: true
@ -83,7 +83,7 @@ export default function Bookmarks(): ReactElement {
const { appConfig } = useSiteMetadata()
const { bookmarks } = useUserPreferences()
const [pinned, setPinned] = useState<DDO[]>()
const [pinned, setPinned] = useState<AssetListPrices[]>()
const [isLoading, setIsLoading] = useState<boolean>()
const { chainIds } = useUserPreferences()
@ -106,7 +106,10 @@ export default function Bookmarks(): ReactElement {
chainIds,
source.token
)
setPinned(resultPinned?.results)
const pinnedAssets: AssetListPrices[] = await getAssetsBestPrices(
resultPinned?.results
)
setPinned(pinnedAssets)
} catch (error) {
Logger.error(error.message)
}