mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
* get poolShares dt addresses * style fixes * class names fix * remove useless changes * fix * try/catch blocks, loading fix * show pool shares fix * delete logs, fix build * more try/catch blocks * check subgraph url, add try/catch block * fixes * pool fields fix * minor code fixes * fix subgraph fetch Signed-off-by: mihaisc <mihai.scarlat@smartcontrol.ro> * remove unused function, fixes * use LoggerInstance, remove useless setter * error messages fix, get rid of dt column * small tweaks and tests * fixes * fixes * modified flow for pool shares * loading UX fixes * unified calculations for pool liquidity * stop the refetch madness * profile provider already sets interval fetching for pool shares * pool shares will change when chainIds, accountId is changed so no need to listen for changes again * calculation tweaks * pool stats tweak * fix pool transactions * fix data display in pool shares section * minor fix, delete comment * subgraph typings generation fix * pool stats display tweaks * price sizing fix * rabbit hole fixes * more price UI fixes * cleanup * wording consistency * render all frontpage sections by default, load in assets after Co-authored-by: ClaudiaHolhos <claudia@oceanprotocol.com> Co-authored-by: mihaisc <mihai.scarlat@smartcontrol.ro> Co-authored-by: mihaisc <mihai@oceanprotocol.com> Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
62 lines
1.8 KiB
TypeScript
62 lines
1.8 KiB
TypeScript
import Conversion from '@shared/Price/Conversion'
|
|
import { Field, useField, useFormikContext } from 'formik'
|
|
import React, { ReactElement } from 'react'
|
|
import Input from '@shared/FormInput'
|
|
import Error from './Error'
|
|
import PriceUnit from '@shared/Price/PriceUnit'
|
|
import styles from './Price.module.css'
|
|
import { FormPublishData } from '../_types'
|
|
import { getFieldContent } from '../_utils'
|
|
|
|
export default function Price({
|
|
firstPrice,
|
|
content
|
|
}: {
|
|
firstPrice?: string
|
|
content?: any
|
|
}): ReactElement {
|
|
const [field, meta] = useField('pricing.price')
|
|
|
|
const { values } = useFormikContext<FormPublishData>()
|
|
const { dataTokenOptions } = values.services[0]
|
|
|
|
return (
|
|
<div className={styles.price}>
|
|
{values.pricing.type === 'free' ? (
|
|
<div className={styles.free}>
|
|
<Field
|
|
{...getFieldContent('freeAgreement', content.fields)}
|
|
component={Input}
|
|
name="pricing.freeAgreement"
|
|
/>
|
|
</div>
|
|
) : (
|
|
<>
|
|
<div className={styles.grid}>
|
|
<div className={styles.form}>
|
|
<Input type="number" prefix="OCEAN" {...field} />
|
|
<Error meta={meta} />
|
|
</div>
|
|
<div className={styles.datatoken}>
|
|
<h4>
|
|
= <strong>1</strong> {dataTokenOptions.symbol}{' '}
|
|
<Conversion price={field.value} className={styles.conversion} />
|
|
</h4>
|
|
</div>
|
|
</div>
|
|
{firstPrice && (
|
|
<aside className={styles.firstPrice}>
|
|
Expected first price:{' '}
|
|
<PriceUnit
|
|
price={Number(firstPrice) > 0 ? firstPrice : '-'}
|
|
size="small"
|
|
conversion
|
|
/>
|
|
</aside>
|
|
)}
|
|
</>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|