diff --git a/src/@context/Asset.tsx b/src/@context/Asset.tsx index 0eebb77e6..abaed455f 100644 --- a/src/@context/Asset.tsx +++ b/src/@context/Asset.tsx @@ -18,7 +18,7 @@ import { getAccessDetails } from '@utils/accessDetailsAndPricing' import { useIsMounted } from '@hooks/useIsMounted' import { useMarketMetadata } from './MarketMetadata' -interface AssetProviderValue { +export interface AssetProviderValue { isInPurgatory: boolean purgatoryData: Purgatory asset: AssetExtended diff --git a/src/@context/MarketMetadata/_queries.ts b/src/@context/MarketMetadata/_queries.ts index 84586f82f..ba13dd606 100644 --- a/src/@context/MarketMetadata/_queries.ts +++ b/src/@context/MarketMetadata/_queries.ts @@ -5,7 +5,9 @@ export const opcQuery = gql` opc(id: 1) { swapOceanFee swapNonOceanFee - approvedTokens + approvedTokens { + id + } id } } diff --git a/src/@context/MarketMetadata/index.tsx b/src/@context/MarketMetadata/index.tsx index 209fac7c0..a9e2145b9 100644 --- a/src/@context/MarketMetadata/index.tsx +++ b/src/@context/MarketMetadata/index.tsx @@ -36,7 +36,7 @@ function MarketMetadataProvider({ opcData.push({ chainId: appConfig.chainIdsSupported[i], - approvedTokens: response.data?.opc.approvedTokens, + approvedTokens: response.data?.opc.approvedTokens?.map((x) => x.id), swapApprovedFee: response.data?.opc.swapOceanFee, swapNotApprovedFee: response.data?.opc.swapNonOceanFee } as OpcFee) diff --git a/src/@utils/provider.ts b/src/@utils/provider.ts index 5ba257d25..30497d5f6 100644 --- a/src/@utils/provider.ts +++ b/src/@utils/provider.ts @@ -9,7 +9,7 @@ import Web3 from 'web3' // TODO: Why do we have these one line functions ?!?!?! export async function getEncryptedFiles( - files: FileMetadata[], + files: any, providerUrl: string ): Promise { try { diff --git a/src/components/@shared/atoms/Button/index.module.css b/src/components/@shared/atoms/Button/index.module.css index e187b43cf..63a509ea2 100644 --- a/src/components/@shared/atoms/Button/index.module.css +++ b/src/components/@shared/atoms/Button/index.module.css @@ -20,15 +20,6 @@ text-align: center; } -.button:first-child { - margin-left: 0; -} - -.button:last-child { - margin-right: 0; - min-width: auto; -} - .button:hover, .button:focus { color: var(--brand-white); diff --git a/src/components/@shared/atoms/Loader/index.module.css b/src/components/@shared/atoms/Loader/index.module.css index 8519d8f1a..319ab7dfb 100644 --- a/src/components/@shared/atoms/Loader/index.module.css +++ b/src/components/@shared/atoms/Loader/index.module.css @@ -23,6 +23,11 @@ margin-left: calc(var(--spacer) / 4); } +.loader.white { + border-color: rgba(255 255 255 / 0.3); + border-top-color: var(--brand-white); +} + @keyframes loader { to { transform: rotate(360deg); diff --git a/src/components/@shared/atoms/Loader/index.tsx b/src/components/@shared/atoms/Loader/index.tsx index b8a97987f..57c6070b3 100644 --- a/src/components/@shared/atoms/Loader/index.tsx +++ b/src/components/@shared/atoms/Loader/index.tsx @@ -3,12 +3,13 @@ import styles from './index.module.css' export interface LoaderProps { message?: string + white?: boolean } -export default function Loader({ message }: LoaderProps): ReactElement { +export default function Loader({ message, white }: LoaderProps): ReactElement { return (
- + {message && {message}}
) diff --git a/src/components/Asset/AssetContent/MetaMain/MetaAsset.tsx b/src/components/Asset/AssetContent/MetaMain/MetaAsset.tsx index 9deca7fce..242fa6c44 100644 --- a/src/components/Asset/AssetContent/MetaMain/MetaAsset.tsx +++ b/src/components/Asset/AssetContent/MetaMain/MetaAsset.tsx @@ -5,13 +5,14 @@ import AddToken from '@shared/AddToken' import ExplorerLink from '@shared/ExplorerLink' import Publisher from '@shared/Publisher' import React, { ReactElement } from 'react' +import { AssetExtended } from 'src/@types/AssetExtended' import styles from './MetaAsset.module.css' export default function MetaAsset({ asset, isBlockscoutExplorer }: { - asset: Asset + asset: AssetExtended isBlockscoutExplorer: boolean }): ReactElement { const { isAssetNetwork } = useAsset() diff --git a/src/components/Asset/AssetContent/MetaMain/MetaInfo.tsx b/src/components/Asset/AssetContent/MetaMain/MetaInfo.tsx index 08b62631a..3188aca70 100644 --- a/src/components/Asset/AssetContent/MetaMain/MetaInfo.tsx +++ b/src/components/Asset/AssetContent/MetaMain/MetaInfo.tsx @@ -1,16 +1,17 @@ -import { Asset } from '@oceanprotocol/lib' +import { useAsset } from '@context/Asset' import AssetType from '@shared/AssetType' import Time from '@shared/atoms/Time' import Publisher from '@shared/Publisher' import { getServiceByName } from '@utils/ddo' import React, { ReactElement } from 'react' +import { AssetExtended } from 'src/@types/AssetExtended' import styles from './MetaInfo.module.css' export default function MetaInfo({ asset, nftPublisher }: { - asset: Asset + asset: AssetExtended nftPublisher: string }): ReactElement { const isCompute = Boolean(getServiceByName(asset, 'compute')) diff --git a/src/components/Asset/AssetContent/MetaMain/index.module.css b/src/components/Asset/AssetContent/MetaMain/index.module.css index 389bf2038..f04afa777 100644 --- a/src/components/Asset/AssetContent/MetaMain/index.module.css +++ b/src/components/Asset/AssetContent/MetaMain/index.module.css @@ -13,32 +13,3 @@ height: calc(var(--spacer) * 2); border-bottom: 1px solid var(--border-color); } - -.nftImage { - position: relative; - margin: 0; - border-right: 1px solid var(--border-color); - width: calc(var(--spacer) * 2); - height: calc(var(--spacer) * 2); -} - -.nftImage img, -.nftImage > svg:first-of-type { - width: 100%; - height: 100%; -} - -.nftImage > svg:first-of-type { - transform: scale(0.7); -} - -.nftImage .tooltip { - position: absolute; - padding: 0; - left: 0; - bottom: 0; -} - -.nftImage .tooltip svg { - fill: var(--font-color-text); -} diff --git a/src/components/Asset/AssetContent/MetaMain/index.tsx b/src/components/Asset/AssetContent/MetaMain/index.tsx index b233704e8..463444a49 100644 --- a/src/components/Asset/AssetContent/MetaMain/index.tsx +++ b/src/components/Asset/AssetContent/MetaMain/index.tsx @@ -1,14 +1,11 @@ import React, { ReactElement } from 'react' import styles from './index.module.css' -import { AssetExtended } from 'src/@types/AssetExtended' -import { decodeTokenURI } from '@utils/nft' import MetaAsset from './MetaAsset' import MetaInfo from './MetaInfo' -import Tooltip from '@shared/atoms/Tooltip' -import NftTooltip from './NftTooltip' -import Logo from '@shared/atoms/Logo' -import { FormPublishData } from '../../../Publish/_types' -import { useFormikContext } from 'formik' +import Nft from '../Nft' +import { AssetExtended } from 'src/@types/AssetExtended' + +const blockscoutNetworks = [1287, 2021000, 2021001, 44787, 246, 1285] export default function MetaMain({ asset, @@ -17,51 +14,12 @@ export default function MetaMain({ asset: AssetExtended nftPublisher: string }): ReactElement { - const nftMetadata = decodeTokenURI(asset?.nft?.tokenURI) - - const blockscoutNetworks = [1287, 2021000, 2021001, 44787, 246, 1285] const isBlockscoutExplorer = blockscoutNetworks.includes(asset?.chainId) - // TODO: using this for the publish preview works fine, but produces a console warning - // on asset details page as there is no formik context there: - // Warning: Formik context is undefined, please verify you are calling useFormikContext() - // as child of a component. - const formikState = useFormikContext() - - // checking if the NFT has an image associated (tokenURI) - // if tokenURI is undefined, then we are in Preview - // for Preview we need to show accessDetails.dataImage - // as this is where the NFT's SVG (during publish) is stored - const nftImage = nftMetadata?.image_data - ? nftMetadata.image_data - : formikState?.values?.metadata?.nft?.image_data - ? formikState.values.metadata.nft.image_data - : null - return (