1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-06-26 03:06:49 +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
isLoading?: boolean
}): ReactElement {
if (!file) return null
const styleClasses = cx({
file: true,
small: small,
@ -37,7 +35,7 @@ export default function FileIcon({
return (
<ul className={styleClasses}>
{isLoading === false || isLoading === undefined ? (
{!isLoading && file ? (
<>
{file.contentType || file.contentLength ? (
<>

View File

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