1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

fix code after prev merge

This commit is contained in:
EnzoVezzaro 2022-10-20 08:17:36 -04:00
parent 120af82e18
commit d88b4c9d5d

View File

@ -3,6 +3,7 @@ import Button from '../atoms/Button'
import styles from './index.module.css' import styles from './index.module.css'
import Loader from '../atoms/Loader' import Loader from '../atoms/Loader'
import { useWeb3 } from '@context/Web3' import { useWeb3 } from '@context/Web3'
import Web3 from 'web3'
interface ButtonBuyProps { interface ButtonBuyProps {
action: 'download' | 'compute' action: 'download' | 'compute'
@ -33,7 +34,6 @@ interface ButtonBuyProps {
hasProviderFee?: boolean hasProviderFee?: boolean
} }
// TODO: we need to take a look at these messages
function getConsumeHelpText( function getConsumeHelpText(
btSymbol: string, btSymbol: string,
dtBalance: string, dtBalance: string,
@ -45,7 +45,7 @@ function getConsumeHelpText(
isBalanceSufficient: boolean, isBalanceSufficient: boolean,
consumableFeedback: string, consumableFeedback: string,
isSupportedOceanNetwork: boolean, isSupportedOceanNetwork: boolean,
web3: any web3: Web3
) { ) {
const text = const text =
isConsumable === false isConsumable === false
@ -68,10 +68,9 @@ function getAlgoHelpText(
hasPreviousOrderSelectedComputeAsset: boolean, hasPreviousOrderSelectedComputeAsset: boolean,
selectedComputeAssetType: string, selectedComputeAssetType: string,
hasDatatokenSelectedComputeAsset: boolean, hasDatatokenSelectedComputeAsset: boolean,
selectedComputeAssettLowPoolLiquidity: boolean,
isBalanceSufficient: boolean, isBalanceSufficient: boolean,
isSupportedOceanNetwork: boolean, isSupportedOceanNetwork: boolean,
web3: any web3: Web3
) { ) {
const text = const text =
(!dtSymbolSelectedComputeAsset && !dtBalanceSelectedComputeAsset) || (!dtSymbolSelectedComputeAsset && !dtBalanceSelectedComputeAsset) ||
@ -82,8 +81,6 @@ function getAlgoHelpText(
? `You already bought the selected ${selectedComputeAssetType}, allowing you to use it without paying again.` ? `You already bought the selected ${selectedComputeAssetType}, allowing you to use it without paying again.`
: hasDatatokenSelectedComputeAsset : hasDatatokenSelectedComputeAsset
? `You own ${dtBalanceSelectedComputeAsset} ${dtSymbolSelectedComputeAsset} allowing you to use the selected ${selectedComputeAssetType} by spending 1 ${dtSymbolSelectedComputeAsset}, but without paying OCEAN again.` ? `You own ${dtBalanceSelectedComputeAsset} ${dtSymbolSelectedComputeAsset} allowing you to use the selected ${selectedComputeAssetType} by spending 1 ${dtSymbolSelectedComputeAsset}, but without paying OCEAN again.`
: selectedComputeAssettLowPoolLiquidity
? `There are not enought ${dtSymbolSelectedComputeAsset} available in the pool for the transaction to take place`
: web3 && !isSupportedOceanNetwork : web3 && !isSupportedOceanNetwork
? `Connect to the correct network to interact with this asset.` ? `Connect to the correct network to interact with this asset.`
: isBalanceSufficient === false : isBalanceSufficient === false
@ -109,7 +106,7 @@ function getComputeAssetHelpText(
selectedComputeAssetType?: string, selectedComputeAssetType?: string,
isAlgorithmConsumable?: boolean, isAlgorithmConsumable?: boolean,
isSupportedOceanNetwork?: boolean, isSupportedOceanNetwork?: boolean,
web3?: any, web3?: Web3,
hasProviderFee?: boolean hasProviderFee?: boolean
) { ) {
const computeAssetHelpText = getConsumeHelpText( const computeAssetHelpText = getConsumeHelpText(
@ -126,18 +123,19 @@ function getComputeAssetHelpText(
web3 web3
) )
const computeAlgoHelpText = const computeAlgoHelpText = getAlgoHelpText(
(!dtSymbolSelectedComputeAsset && !dtBalanceSelectedComputeAsset) || dtSymbolSelectedComputeAsset,
isConsumable === false || dtBalanceSelectedComputeAsset,
isAlgorithmConsumable === false isConsumable,
? '' isAlgorithmConsumable,
: hasPreviousOrderSelectedComputeAsset hasPreviousOrderSelectedComputeAsset,
? `You already bought the selected ${selectedComputeAssetType}, allowing you to use it without paying again.` selectedComputeAssetType,
: hasDatatokenSelectedComputeAsset hasDatatokenSelectedComputeAsset,
? `You own ${dtBalanceSelectedComputeAsset} ${dtSymbolSelectedComputeAsset} allowing you to use the selected ${selectedComputeAssetType} by spending 1 ${dtSymbolSelectedComputeAsset}, but without paying ${btSymbol} again.` isBalanceSufficient,
: isBalanceSufficient === false isSupportedOceanNetwork,
? '' web3
: `Additionally, you will buy 1 ${dtSymbolSelectedComputeAsset} for the ${selectedComputeAssetType} and spend it back to its publisher.` )
const providerFeeHelpText = hasProviderFee const providerFeeHelpText = hasProviderFee
? 'In order to start the job you also need to pay the fees for renting the c2d resources.' ? 'In order to start the job you also need to pay the fees for renting the c2d resources.'
: 'C2D resources required to start the job are available, no payment required for those fees.' : 'C2D resources required to start the job are available, no payment required for those fees.'