mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
check also DT for total pice calculation and amount to spend display (#533)
This commit is contained in:
parent
545be24429
commit
749b5d1f8d
@ -108,17 +108,21 @@ export default function FormStartCompute({
|
||||
useEffect(() => {
|
||||
if (!price || !algorithmPrice) return
|
||||
|
||||
const priceDataset = hasPreviousOrder ? 0 : Number(price.value)
|
||||
const priceAlgo = hasPreviousOrderSelectedComputeAsset
|
||||
? 0
|
||||
: Number(algorithmPrice.value)
|
||||
const priceDataset =
|
||||
hasPreviousOrder || hasDatatoken ? 0 : Number(price.value)
|
||||
const priceAlgo =
|
||||
hasPreviousOrderSelectedComputeAsset || hasDatatokenSelectedComputeAsset
|
||||
? 0
|
||||
: Number(algorithmPrice.value)
|
||||
|
||||
setTotalPrice(priceDataset + priceAlgo)
|
||||
}, [
|
||||
price,
|
||||
algorithmPrice,
|
||||
hasPreviousOrder,
|
||||
hasPreviousOrderSelectedComputeAsset
|
||||
hasDatatoken,
|
||||
hasPreviousOrderSelectedComputeAsset,
|
||||
hasDatatokenSelectedComputeAsset
|
||||
])
|
||||
|
||||
return (
|
||||
@ -138,7 +142,9 @@ export default function FormStartCompute({
|
||||
hasPreviousOrderSelectedComputeAsset={
|
||||
hasPreviousOrderSelectedComputeAsset
|
||||
}
|
||||
hasDatatoken={hasDatatoken}
|
||||
selectedComputeAssetTimeout={selectedComputeAssetTimeout}
|
||||
hasDatatokenSelectedComputeAsset={hasDatatokenSelectedComputeAsset}
|
||||
algorithmPrice={algorithmPrice}
|
||||
totalPrice={totalPrice}
|
||||
/>
|
||||
|
@ -8,8 +8,10 @@ import styles from './PriceOutput.module.css'
|
||||
interface PriceOutputProps {
|
||||
totalPrice: number
|
||||
hasPreviousOrder: boolean
|
||||
hasDatatoken: boolean
|
||||
assetTimeout: string
|
||||
hasPreviousOrderSelectedComputeAsset: boolean
|
||||
hasDatatokenSelectedComputeAsset: boolean
|
||||
algorithmPrice: BestPrice
|
||||
selectedComputeAssetTimeout: string
|
||||
}
|
||||
@ -17,11 +19,13 @@ interface PriceOutputProps {
|
||||
function Row({
|
||||
price,
|
||||
hasPreviousOrder,
|
||||
hasDatatoken,
|
||||
timeout,
|
||||
sign
|
||||
}: {
|
||||
price: number
|
||||
hasPreviousOrder?: boolean
|
||||
hasDatatoken?: boolean
|
||||
timeout?: string
|
||||
sign?: string
|
||||
}) {
|
||||
@ -30,7 +34,7 @@ function Row({
|
||||
<div className={styles.sign}>{sign}</div>
|
||||
<div>
|
||||
<PriceUnit
|
||||
price={hasPreviousOrder ? '0' : `${price}`}
|
||||
price={hasPreviousOrder || hasDatatoken ? '0' : `${price}`}
|
||||
small
|
||||
className={styles.price}
|
||||
/>
|
||||
@ -48,8 +52,10 @@ function Row({
|
||||
export default function PriceOutput({
|
||||
totalPrice,
|
||||
hasPreviousOrder,
|
||||
hasDatatoken,
|
||||
assetTimeout,
|
||||
hasPreviousOrderSelectedComputeAsset,
|
||||
hasDatatokenSelectedComputeAsset,
|
||||
algorithmPrice,
|
||||
selectedComputeAssetTimeout
|
||||
}: PriceOutputProps): ReactElement {
|
||||
@ -63,11 +69,13 @@ export default function PriceOutput({
|
||||
<div className={styles.calculation}>
|
||||
<Row
|
||||
hasPreviousOrder={hasPreviousOrder}
|
||||
hasDatatoken={hasDatatoken}
|
||||
price={price?.value}
|
||||
timeout={assetTimeout}
|
||||
/>
|
||||
<Row
|
||||
hasPreviousOrder={hasPreviousOrderSelectedComputeAsset}
|
||||
hasDatatoken={hasDatatokenSelectedComputeAsset}
|
||||
price={algorithmPrice?.value}
|
||||
timeout={selectedComputeAssetTimeout}
|
||||
sign="+"
|
||||
|
Loading…
Reference in New Issue
Block a user