1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 09:44:53 +01:00

check also DT for total pice calculation and amount to spend display (#533)

This commit is contained in:
Bogdan Fazakas 2021-04-16 15:25:35 +03:00 committed by GitHub
parent 545be24429
commit 749b5d1f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View File

@ -108,8 +108,10 @@ export default function FormStartCompute({
useEffect(() => { useEffect(() => {
if (!price || !algorithmPrice) return if (!price || !algorithmPrice) return
const priceDataset = hasPreviousOrder ? 0 : Number(price.value) const priceDataset =
const priceAlgo = hasPreviousOrderSelectedComputeAsset hasPreviousOrder || hasDatatoken ? 0 : Number(price.value)
const priceAlgo =
hasPreviousOrderSelectedComputeAsset || hasDatatokenSelectedComputeAsset
? 0 ? 0
: Number(algorithmPrice.value) : Number(algorithmPrice.value)
@ -118,7 +120,9 @@ export default function FormStartCompute({
price, price,
algorithmPrice, algorithmPrice,
hasPreviousOrder, hasPreviousOrder,
hasPreviousOrderSelectedComputeAsset hasDatatoken,
hasPreviousOrderSelectedComputeAsset,
hasDatatokenSelectedComputeAsset
]) ])
return ( return (
@ -138,7 +142,9 @@ export default function FormStartCompute({
hasPreviousOrderSelectedComputeAsset={ hasPreviousOrderSelectedComputeAsset={
hasPreviousOrderSelectedComputeAsset hasPreviousOrderSelectedComputeAsset
} }
hasDatatoken={hasDatatoken}
selectedComputeAssetTimeout={selectedComputeAssetTimeout} selectedComputeAssetTimeout={selectedComputeAssetTimeout}
hasDatatokenSelectedComputeAsset={hasDatatokenSelectedComputeAsset}
algorithmPrice={algorithmPrice} algorithmPrice={algorithmPrice}
totalPrice={totalPrice} totalPrice={totalPrice}
/> />

View File

@ -8,8 +8,10 @@ import styles from './PriceOutput.module.css'
interface PriceOutputProps { interface PriceOutputProps {
totalPrice: number totalPrice: number
hasPreviousOrder: boolean hasPreviousOrder: boolean
hasDatatoken: boolean
assetTimeout: string assetTimeout: string
hasPreviousOrderSelectedComputeAsset: boolean hasPreviousOrderSelectedComputeAsset: boolean
hasDatatokenSelectedComputeAsset: boolean
algorithmPrice: BestPrice algorithmPrice: BestPrice
selectedComputeAssetTimeout: string selectedComputeAssetTimeout: string
} }
@ -17,11 +19,13 @@ interface PriceOutputProps {
function Row({ function Row({
price, price,
hasPreviousOrder, hasPreviousOrder,
hasDatatoken,
timeout, timeout,
sign sign
}: { }: {
price: number price: number
hasPreviousOrder?: boolean hasPreviousOrder?: boolean
hasDatatoken?: boolean
timeout?: string timeout?: string
sign?: string sign?: string
}) { }) {
@ -30,7 +34,7 @@ function Row({
<div className={styles.sign}>{sign}</div> <div className={styles.sign}>{sign}</div>
<div> <div>
<PriceUnit <PriceUnit
price={hasPreviousOrder ? '0' : `${price}`} price={hasPreviousOrder || hasDatatoken ? '0' : `${price}`}
small small
className={styles.price} className={styles.price}
/> />
@ -48,8 +52,10 @@ function Row({
export default function PriceOutput({ export default function PriceOutput({
totalPrice, totalPrice,
hasPreviousOrder, hasPreviousOrder,
hasDatatoken,
assetTimeout, assetTimeout,
hasPreviousOrderSelectedComputeAsset, hasPreviousOrderSelectedComputeAsset,
hasDatatokenSelectedComputeAsset,
algorithmPrice, algorithmPrice,
selectedComputeAssetTimeout selectedComputeAssetTimeout
}: PriceOutputProps): ReactElement { }: PriceOutputProps): ReactElement {
@ -63,11 +69,13 @@ export default function PriceOutput({
<div className={styles.calculation}> <div className={styles.calculation}>
<Row <Row
hasPreviousOrder={hasPreviousOrder} hasPreviousOrder={hasPreviousOrder}
hasDatatoken={hasDatatoken}
price={price?.value} price={price?.value}
timeout={assetTimeout} timeout={assetTimeout}
/> />
<Row <Row
hasPreviousOrder={hasPreviousOrderSelectedComputeAsset} hasPreviousOrder={hasPreviousOrderSelectedComputeAsset}
hasDatatoken={hasDatatokenSelectedComputeAsset}
price={algorithmPrice?.value} price={algorithmPrice?.value}
timeout={selectedComputeAssetTimeout} timeout={selectedComputeAssetTimeout}
sign="+" sign="+"