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

add price to preview, default to dynamic

This commit is contained in:
Matthias Kretschmann 2020-10-06 13:39:23 +02:00
parent 1d55b01398
commit 41b20f59ca
Signed by: m
GPG Key ID: 606EEEF3C479A91F
3 changed files with 36 additions and 4 deletions

View File

@ -29,5 +29,14 @@
} }
.file { .file {
}
.asset {
display: grid;
grid-template-columns: 1fr 4fr;
align-items: center;
margin-bottom: calc(var(--spacer) / 2); margin-bottom: calc(var(--spacer) / 2);
} }
.price {
}

View File

@ -7,6 +7,8 @@ import styles from './Preview.module.css'
import File from '../../atoms/File' import File from '../../atoms/File'
import { MetadataPublishForm } from '../../../@types/MetaData' import { MetadataPublishForm } from '../../../@types/MetaData'
import Button from '../../atoms/Button' import Button from '../../atoms/Button'
import Conversion from '../../atoms/Price/Conversion'
import PriceUnit from '../../atoms/Price/PriceUnit'
export default function Preview({ export default function Preview({
values values
@ -19,15 +21,36 @@ export default function Preview({
<header> <header>
{values.name && <h3 className={styles.title}>{values.name}</h3>} {values.name && <h3 className={styles.title}>{values.name}</h3>}
{values.description && <Markdown text={values.description} />} {values.description && <Markdown text={values.description} />}
{values.files &&
typeof values.files !== 'string' && <div className={styles.asset}>
values.files.length > 0 && ( {values.files?.length > 0 && typeof values.files !== 'string' && (
<File <File
file={values.files[0] as FileMetadata} file={values.files[0] as FileMetadata}
className={styles.file} className={styles.file}
small small
/> />
)} )}
{values.price && (
<div className={styles.price}>
<MetaItem
title={`Price: ${values.price.type}`}
content={
<>
<PriceUnit
price="1"
symbol={values.price.datatoken?.symbol}
small
/>{' '}
= <PriceUnit price={`${values.price.price}`} small />
<Conversion price={`${values.price.price}`} />
</>
}
/>
</div>
)}
</div>
{typeof values.links !== 'string' && values.links?.length && ( {typeof values.links !== 'string' && values.links?.length && (
<Button <Button
href={(values.links[0] as FileMetadata).url} href={(values.links[0] as FileMetadata).url}

View File

@ -47,7 +47,7 @@ export const initialValues: Partial<MetadataPublishForm> = {
author: '', author: '',
price: { price: {
price: 1, price: 1,
type: 'fixed', type: 'dynamic',
tokensToMint: 1, tokensToMint: 1,
weightOnDataToken: '9', // 90% on data token weightOnDataToken: '9', // 90% on data token
swapFee: 0.1 // in % swapFee: 0.1 // in %