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

update compute help text

This commit is contained in:
Bogdan Fazakas 2022-06-20 06:54:26 +03:00
parent e222b730af
commit 455a68a29c
2 changed files with 15 additions and 5 deletions

View File

@ -29,6 +29,7 @@ interface ButtonBuyProps {
priceType?: string priceType?: string
algorithmPriceType?: string algorithmPriceType?: string
isAlgorithmConsumable?: boolean isAlgorithmConsumable?: boolean
hasProviderFee?: boolean
} }
// TODO: we need to take a look at these messages // TODO: we need to take a look at these messages
@ -75,7 +76,8 @@ function getComputeAssetHelpText(
dtBalanceSelectedComputeAsset?: string, dtBalanceSelectedComputeAsset?: string,
selectedComputeAssettLowPoolLiquidity?: boolean, selectedComputeAssettLowPoolLiquidity?: boolean,
selectedComputeAssetType?: string, selectedComputeAssetType?: string,
isAlgorithmConsumable?: boolean isAlgorithmConsumable?: boolean,
hasProviderFee?: boolean
) { ) {
const computeAssetHelpText = getConsumeHelpText( const computeAssetHelpText = getConsumeHelpText(
dtBalance, dtBalance,
@ -102,11 +104,14 @@ function getComputeAssetHelpText(
: isBalanceSufficient === false : isBalanceSufficient === false
? '' ? ''
: `Additionally, you will buy 1 ${dtSymbolSelectedComputeAsset} for the ${selectedComputeAssetType} and spend it back to its publisher and pool.` : `Additionally, you will buy 1 ${dtSymbolSelectedComputeAsset} for the ${selectedComputeAssetType} and spend it back to its publisher and pool.`
const providerFeeHelpText = hasProviderFee
? '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.'
const computeHelpText = selectedComputeAssettLowPoolLiquidity const computeHelpText = selectedComputeAssettLowPoolLiquidity
? computeAlgoHelpText ? computeAlgoHelpText
: lowPoolLiquidity : lowPoolLiquidity
? computeAssetHelpText ? computeAssetHelpText
: `${computeAssetHelpText} ${computeAlgoHelpText}` : `${computeAssetHelpText} ${computeAlgoHelpText} ${providerFeeHelpText}`
return computeHelpText return computeHelpText
} }
@ -135,7 +140,8 @@ export default function ButtonBuy({
type, type,
priceType, priceType,
algorithmPriceType, algorithmPriceType,
isAlgorithmConsumable isAlgorithmConsumable,
hasProviderFee
}: ButtonBuyProps): ReactElement { }: ButtonBuyProps): ReactElement {
const buttonText = const buttonText =
action === 'download' action === 'download'
@ -144,7 +150,9 @@ export default function ButtonBuy({
: priceType === 'free' : priceType === 'free'
? 'Get' ? 'Get'
: `Buy ${assetTimeout === 'Forever' ? '' : ` for ${assetTimeout}`}` : `Buy ${assetTimeout === 'Forever' ? '' : ` for ${assetTimeout}`}`
: hasPreviousOrder && hasPreviousOrderSelectedComputeAsset : hasPreviousOrder &&
hasPreviousOrderSelectedComputeAsset &&
!hasProviderFee
? 'Start Compute Job' ? 'Start Compute Job'
: priceType === 'free' && algorithmPriceType === 'free' : priceType === 'free' && algorithmPriceType === 'free'
? 'Order Compute Job' ? 'Order Compute Job'
@ -194,7 +202,8 @@ export default function ButtonBuy({
dtBalanceSelectedComputeAsset, dtBalanceSelectedComputeAsset,
selectedComputeAssetLowPoolLiquidity, selectedComputeAssetLowPoolLiquidity,
selectedComputeAssetType, selectedComputeAssetType,
isAlgorithmConsumable isAlgorithmConsumable,
hasProviderFee
)} )}
</div> </div>
</> </>

View File

@ -241,6 +241,7 @@ export default function FormStartCompute({
isAlgorithmConsumable={ isAlgorithmConsumable={
selectedAlgorithmAsset?.accessDetails?.isPurchasable selectedAlgorithmAsset?.accessDetails?.isPurchasable
} }
hasProviderFee={providerFeeAmount && providerFeeAmount !== '0'}
/> />
</Form> </Form>
) )