diff --git a/src/@context/Asset.tsx b/src/@context/Asset.tsx index 918c9ab14..92ebfc14b 100644 --- a/src/@context/Asset.tsx +++ b/src/@context/Asset.tsx @@ -76,8 +76,7 @@ function AssetProvider({ LoggerInstance.error(`[asset] Failed getting asset for ${did}`, asset) return } - - if (asset.nft.state) { + if (asset.nft.state !== 0 && asset.nft.state !== 4) { // handle nft states as documented in https://docs.oceanprotocol.com/concepts/did-ddo/#state let state switch (asset.nft.state) { diff --git a/src/components/Asset/AssetActions/Download.tsx b/src/components/Asset/AssetActions/Download.tsx index ac9e3f1a5..669e2ddb9 100644 --- a/src/components/Asset/AssetActions/Download.tsx +++ b/src/components/Asset/AssetActions/Download.tsx @@ -45,11 +45,15 @@ export default function Download({ const [isPriceLoading, setIsPriceLoading] = useState(false) const [isOwned, setIsOwned] = useState(false) const [validOrderTx, setValidOrderTx] = useState('') + const [isOrderDisabled, setIsOrderDisabled] = useState(false) const [orderPriceAndFees, setOrderPriceAndFees] = useState() const isUnsupportedPricing = asset?.accessDetails?.type === 'NOT_SUPPORTED' + useEffect(() => { + Number(asset?.nft.state) === 4 && setIsOrderDisabled(true) + }, [asset?.nft.state]) useEffect(() => { if (!asset?.accessDetails || isUnsupportedPricing) return @@ -183,26 +187,36 @@ export default function Download({ const AssetAction = ({ asset }: { asset: AssetExtended }) => { return (
- {isUnsupportedPricing ? ( + {isOrderDisabled ? ( ) : ( <> - {isPriceLoading ? ( - - ) : ( - - )} + ) : ( + <> + {isPriceLoading ? ( + + ) : ( + + )} - {!isInPurgatory && } + {!isInPurgatory && } + + )} )}