mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Disable ordering when state is 4 (#1746)
* fix state 4 * update var name * fix typo
This commit is contained in:
parent
67621f5639
commit
af93b561ad
src
@ -76,8 +76,7 @@ function AssetProvider({
|
||||
LoggerInstance.error(`[asset] Failed getting asset for ${did}`, asset)
|
||||
return
|
||||
}
|
||||
|
||||
if (asset.nft.state) {
|
||||
if (asset.nft.state !== 0 && asset.nft.state !== 4) {
|
||||
// handle nft states as documented in https://docs.oceanprotocol.com/concepts/did-ddo/#state
|
||||
let state
|
||||
switch (asset.nft.state) {
|
||||
|
@ -45,11 +45,15 @@ export default function Download({
|
||||
const [isPriceLoading, setIsPriceLoading] = useState(false)
|
||||
const [isOwned, setIsOwned] = useState(false)
|
||||
const [validOrderTx, setValidOrderTx] = useState('')
|
||||
const [isOrderDisabled, setIsOrderDisabled] = useState(false)
|
||||
const [orderPriceAndFees, setOrderPriceAndFees] =
|
||||
useState<OrderPriceAndFees>()
|
||||
|
||||
const isUnsupportedPricing = asset?.accessDetails?.type === 'NOT_SUPPORTED'
|
||||
|
||||
useEffect(() => {
|
||||
Number(asset?.nft.state) === 4 && setIsOrderDisabled(true)
|
||||
}, [asset?.nft.state])
|
||||
useEffect(() => {
|
||||
if (!asset?.accessDetails || isUnsupportedPricing) return
|
||||
|
||||
@ -183,26 +187,36 @@ export default function Download({
|
||||
const AssetAction = ({ asset }: { asset: AssetExtended }) => {
|
||||
return (
|
||||
<div>
|
||||
{isUnsupportedPricing ? (
|
||||
{isOrderDisabled ? (
|
||||
<Alert
|
||||
className={styles.fieldWarning}
|
||||
state="info"
|
||||
text={`No pricing schema available for this asset.`}
|
||||
text={`The publisher temporarily disabled ordering for this asset`}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
{isPriceLoading ? (
|
||||
<Loader message="Calculating full price (including fees)" />
|
||||
) : (
|
||||
<Price
|
||||
accessDetails={asset.accessDetails}
|
||||
orderPriceAndFees={orderPriceAndFees}
|
||||
conversion
|
||||
size="large"
|
||||
{isUnsupportedPricing ? (
|
||||
<Alert
|
||||
className={styles.fieldWarning}
|
||||
state="info"
|
||||
text={`No pricing schema available for this asset.`}
|
||||
/>
|
||||
)}
|
||||
) : (
|
||||
<>
|
||||
{isPriceLoading ? (
|
||||
<Loader message="Calculating full price (including fees)" />
|
||||
) : (
|
||||
<Price
|
||||
accessDetails={asset.accessDetails}
|
||||
orderPriceAndFees={orderPriceAndFees}
|
||||
conversion
|
||||
size="large"
|
||||
/>
|
||||
)}
|
||||
|
||||
{!isInPurgatory && <PurchaseButton />}
|
||||
{!isInPurgatory && <PurchaseButton />}
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user