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

disable price calculation for free price (#1198)

* disable price calculation for free price

* make file icon visible on component mount

* check if accessDetails are present
This commit is contained in:
Norbi 2022-03-18 15:22:26 +02:00 committed by GitHub
parent 9d1b7794a3
commit d1d24ef4d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -27,8 +27,6 @@ export default function FileIcon({
small?: boolean small?: boolean
isLoading?: boolean isLoading?: boolean
}): ReactElement { }): ReactElement {
if (!file) return null
const styleClasses = cx({ const styleClasses = cx({
file: true, file: true,
small: small, small: small,
@ -37,7 +35,7 @@ export default function FileIcon({
return ( return (
<ul className={styleClasses}> <ul className={styleClasses}>
{isLoading === false || isLoading === undefined ? ( {!isLoading && file ? (
<> <>
{file.contentType || file.contentLength ? ( {file.contentType || file.contentLength ? (
<> <>

View File

@ -73,7 +73,11 @@ export default function Download({
setValidOrderTx(asset?.accessDetails?.validOrderTx) setValidOrderTx(asset?.accessDetails?.validOrderTx)
// get full price and fees // get full price and fees
async function init() { async function init() {
if (asset?.accessDetails?.addressOrId === ZERO_ADDRESS) return if (
asset?.accessDetails?.addressOrId === ZERO_ADDRESS ||
asset?.accessDetails?.type === 'free'
)
return
setIsLoading(true) setIsLoading(true)
setStatusText('Calculating price including fees.') setStatusText('Calculating price including fees.')
const orderPriceAndFees = await getOrderPriceAndFees(asset, ZERO_ADDRESS) const orderPriceAndFees = await getOrderPriceAndFees(asset, ZERO_ADDRESS)