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

make all pricing forms work again, retain data between tabs

This commit is contained in:
Matthias Kretschmann 2021-10-27 17:08:26 +01:00
parent c53c7c3093
commit 9960742b37
Signed by: m
GPG Key ID: 606EEEF3C479A91F
5 changed files with 8 additions and 4 deletions

View File

@ -15,8 +15,10 @@ export default function Datatoken(props: InputProps): ReactElement {
// Generate new DT name & symbol on first mount
useEffect(() => {
if (field.value.name !== '') return
generateName()
}, [])
}, [field.value.name])
return (
<div className={styles.datatoken}>

View File

@ -18,7 +18,7 @@ export default function Coin({
weight: string
readOnly?: boolean
}): ReactElement {
const [field, meta] = useField(name)
const [field, meta] = useField(`pricing.${name}`)
return (
<div className={styles.coin}>

View File

@ -36,7 +36,7 @@ export default function Fees({
tooltips: { [key: string]: string }
pricingType: 'dynamic' | 'fixed'
}): ReactElement {
const [field, meta] = useField('swapFee')
const [field, meta] = useField('pricing.swapFee')
return (
<>

View File

@ -14,7 +14,7 @@ export default function Price({
firstPrice?: string
free?: boolean
}): ReactElement {
const [field, meta] = useField('price')
const [field, meta] = useField('pricing.price')
const { values } = useFormikContext<FormPublishData>()
const { dataTokenOptions } = values.services[0]

View File

@ -19,6 +19,8 @@ export default function PricingFields(): ReactElement {
const { pricing } = values
const { price, oceanAmount, weightOnOcean, weightOnDataToken, type } = pricing
console.log(pricing)
// Switch type value upon tab change
function handleTabChange(tabName: string) {
const type = tabName.toLowerCase()