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 // Generate new DT name & symbol on first mount
useEffect(() => { useEffect(() => {
if (field.value.name !== '') return
generateName() generateName()
}, []) }, [field.value.name])
return ( return (
<div className={styles.datatoken}> <div className={styles.datatoken}>

View File

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

View File

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

View File

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

View File

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