From 6c3cf1f121892dcedec37a466780b7aa2e6905fb Mon Sep 17 00:00:00 2001 From: Bogdan Fazakas Date: Wed, 28 Apr 2021 15:23:44 +0300 Subject: [PATCH] Fix/AssetSelection: Algo symbol & DID & Total price issues when no wallet connected (#559) * fixed total price calculation issues * fixed algoSymbol and Did dissappear in Safari --- .../FormFields/AssetSelection.module.css | 4 ++- .../organisms/AssetActions/Compute/index.tsx | 32 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/components/molecules/FormFields/AssetSelection.module.css b/src/components/molecules/FormFields/AssetSelection.module.css index c1fee66bd..eab981be8 100644 --- a/src/components/molecules/FormFields/AssetSelection.module.css +++ b/src/components/molecules/FormFields/AssetSelection.module.css @@ -107,7 +107,9 @@ .did { padding: 0; - font-size: var(--font-size-mini); + /* font-size: var(--font-size-mini); */ + /* hack to make DotDotDot clamp work in Safari*/ + font-size: 0.63rem; display: block; text-align: left; color: var(--color-secondary); diff --git a/src/components/organisms/AssetActions/Compute/index.tsx b/src/components/organisms/AssetActions/Compute/index.tsx index ee6f459ca..9a38e440c 100644 --- a/src/components/organisms/AssetActions/Compute/index.tsx +++ b/src/components/organisms/AssetActions/Compute/index.tsx @@ -261,26 +261,30 @@ export default function Compute({ }, [ocean, ddo, accountId]) useEffect(() => { - if (!ocean || !accountId || !selectedAlgorithmAsset) return + if (!selectedAlgorithmAsset) return - if (selectedAlgorithmAsset.findServiceByType('access')) { - checkPreviousOrders(selectedAlgorithmAsset).then(() => { - if ( - !hasPreviousAlgorithmOrder && - selectedAlgorithmAsset.findServiceByType('compute') - ) { - checkPreviousOrders(selectedAlgorithmAsset) - } - }) - } else if (selectedAlgorithmAsset.findServiceByType('compute')) { - checkPreviousOrders(selectedAlgorithmAsset) - } - checkAssetDTBalance(selectedAlgorithmAsset) initMetadata(selectedAlgorithmAsset) + const { timeout } = ( ddo.findServiceByType('access') || ddo.findServiceByType('compute') ).attributes.main setAlgorithmTimeout(secondsToString(timeout)) + + if (accountId) { + if (selectedAlgorithmAsset.findServiceByType('access')) { + checkPreviousOrders(selectedAlgorithmAsset).then(() => { + if ( + !hasPreviousAlgorithmOrder && + selectedAlgorithmAsset.findServiceByType('compute') + ) { + checkPreviousOrders(selectedAlgorithmAsset) + } + }) + } else if (selectedAlgorithmAsset.findServiceByType('compute')) { + checkPreviousOrders(selectedAlgorithmAsset) + } + } + ocean && checkAssetDTBalance(selectedAlgorithmAsset) }, [selectedAlgorithmAsset, ocean, accountId, hasPreviousAlgorithmOrder]) // Output errors in toast UI