From e9ff4f77177670d0db0725024fcc54d2ed28b145 Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Thu, 23 Jun 2022 17:18:54 +0300 Subject: [PATCH] fix disable compute button if algo is consumable --- src/components/Asset/AssetActions/Compute/index.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/components/Asset/AssetActions/Compute/index.tsx b/src/components/Asset/AssetActions/Compute/index.tsx index 50d9e4ed2..617e88135 100644 --- a/src/components/Asset/AssetActions/Compute/index.tsx +++ b/src/components/Asset/AssetActions/Compute/index.tsx @@ -83,6 +83,8 @@ export default function Compute({ const [validAlgorithmOrderTx, setValidAlgorithmOrderTx] = useState('') const [isConsumablePrice, setIsConsumablePrice] = useState(true) + const [isConsumableaAlgorithmPrice, setIsConsumableAlgorithmPrice] = + useState(true) const [computeStatusText, setComputeStatusText] = useState('') const [computeEnv, setComputeEnv] = useState() const [initializedProviderResponse, setInitializedProviderResponse] = @@ -102,7 +104,9 @@ export default function Compute({ isOrdering === true || file === null || (!validOrderTx && !hasDatatoken && !isConsumablePrice) || - (!validAlgorithmOrderTx && !hasAlgoAssetDatatoken) + (!validAlgorithmOrderTx && + !hasAlgoAssetDatatoken && + !isConsumableaAlgorithmPrice) async function checkAssetDTBalance(asset: DDO): Promise { if (!asset?.services[0].datatokenAddress) return @@ -254,7 +258,9 @@ export default function Compute({ if (!selectedAlgorithmAsset?.accessDetails || !accountId) return setIsRequestingAlgoOrderPrice(true) - setIsConsumablePrice(selectedAlgorithmAsset?.accessDetails?.isPurchasable) + setIsConsumableAlgorithmPrice( + selectedAlgorithmAsset?.accessDetails?.isPurchasable + ) setValidAlgorithmOrderTx( selectedAlgorithmAsset?.accessDetails?.validOrderTx )