1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-11-15 01:34:57 +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 {
}
.asset {
display: grid;
grid-template-columns: 1fr 4fr;
align-items: center;
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 { MetadataPublishForm } from '../../../@types/MetaData'
import Button from '../../atoms/Button'
import Conversion from '../../atoms/Price/Conversion'
import PriceUnit from '../../atoms/Price/PriceUnit'
export default function Preview({
values
@ -19,15 +21,36 @@ export default function Preview({
<header>
{values.name && <h3 className={styles.title}>{values.name}</h3>}
{values.description && <Markdown text={values.description} />}
{values.files &&
typeof values.files !== 'string' &&
values.files.length > 0 && (
<div className={styles.asset}>
{values.files?.length > 0 && typeof values.files !== 'string' && (
<File
file={values.files[0] as FileMetadata}
className={styles.file}
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 && (
<Button
href={(values.links[0] as FileMetadata).url}

View File

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