mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
pricing to displays
This commit is contained in:
parent
74075fab08
commit
552d9a90f8
@ -5,6 +5,8 @@ import Dotdotdot from 'react-dotdotdot'
|
||||
import cx from 'classnames'
|
||||
import styles from './AssetTeaser.module.scss'
|
||||
import CategoryImage from '../atoms/CategoryImage'
|
||||
import { allowPricing } from '../../config'
|
||||
import Web3 from 'web3'
|
||||
|
||||
const AssetTeaser = ({
|
||||
asset,
|
||||
@ -41,7 +43,9 @@ const AssetTeaser = ({
|
||||
<CategoryImage dimmed category={base.categories[0]} />
|
||||
)}
|
||||
<h1>{base.name}</h1>
|
||||
|
||||
{allowPricing
|
||||
? 'Ọ ' + Web3.utils.fromWei(base.price.toString())
|
||||
: null}
|
||||
{!minimal && (
|
||||
<div className={styles.description}>
|
||||
<Dotdotdot clamp={3}>{base.description}</Dotdotdot>
|
||||
|
@ -6,6 +6,8 @@ import CategoryLink from '../../atoms/CategoryLink'
|
||||
import styles from './AssetDetails.module.scss'
|
||||
import AssetFilesDetails from './AssetFilesDetails'
|
||||
import Report from './Report'
|
||||
import { allowPricing } from '../../../config'
|
||||
import Web3 from 'web3'
|
||||
|
||||
interface AssetDetailsProps {
|
||||
metadata: MetaData
|
||||
@ -93,6 +95,23 @@ export default class AssetDetails extends PureComponent<AssetDetailsProps> {
|
||||
<code>{ddo.id}</code>
|
||||
</span>
|
||||
</li>
|
||||
{allowPricing ? (
|
||||
<li>
|
||||
<span className={styles.metaLabel}>
|
||||
<strong>Price</strong>
|
||||
</span>
|
||||
<span className={styles.metaValue}>
|
||||
<code>
|
||||
Ọ{' '}
|
||||
{base.price === '0'
|
||||
? 0
|
||||
: Web3.utils.fromWei(
|
||||
base.price.toString()
|
||||
)}
|
||||
</code>
|
||||
</span>
|
||||
</li>
|
||||
) : null}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -37,13 +37,13 @@ interface PublishState {
|
||||
validationStatus?: any
|
||||
}
|
||||
|
||||
if(allowPricing){
|
||||
(steps as any)[0].fields['price'] = {
|
||||
label: "Price",
|
||||
placeholder: "Price in Ocean tokens",
|
||||
type: "string",
|
||||
if (allowPricing) {
|
||||
;(steps as any)[0].fields['price'] = {
|
||||
label: 'Price',
|
||||
placeholder: 'Price in Ocean tokens',
|
||||
type: 'string',
|
||||
required: true,
|
||||
help: "Enter the price of assets in Ocean tokens."
|
||||
help: 'Enter the price of assets in Ocean tokens.'
|
||||
}
|
||||
}
|
||||
|
||||
@ -292,14 +292,14 @@ class Publish extends Component<{}, PublishState> {
|
||||
license: this.state.license,
|
||||
copyrightHolder: this.state.copyrightHolder,
|
||||
files,
|
||||
price: allowPricing ? Web3.utils.toWei(this.state.price, 'ether') : this.state.price,
|
||||
price: allowPricing
|
||||
? Web3.utils.toWei(this.state.price, 'ether')
|
||||
: this.state.price,
|
||||
type: this.state.type,
|
||||
categories: [this.state.categories]
|
||||
})
|
||||
}
|
||||
|
||||
console.log(newAsset)
|
||||
|
||||
try {
|
||||
const asset = await this.context.ocean.assets
|
||||
.create(newAsset, account[0])
|
||||
|
Loading…
Reference in New Issue
Block a user