mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
pricing feedback fixes
This commit is contained in:
parent
5bf8543150
commit
e2b5707859
src/components/Publish/Pricing
@ -18,8 +18,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
.summary {
|
||||
margin-top: var(--spacer);
|
||||
.subtitle {
|
||||
display: inline-block;
|
||||
color: var(--color-secondary);
|
||||
margin-left: calc(var(--spacer) / 4);
|
||||
font-family: var(--font-family-base);
|
||||
font-weight: var(--font-weight-base);
|
||||
font-size: var(--font-size-small);
|
||||
}
|
||||
|
||||
.alertArea {
|
||||
|
@ -8,13 +8,11 @@ import Fees from './Fees'
|
||||
import { FormikContextType, useFormikContext } from 'formik'
|
||||
import Price from './Price'
|
||||
import Decimal from 'decimal.js'
|
||||
import { useOcean } from '@context/Ocean'
|
||||
import { useWeb3 } from '@context/Web3'
|
||||
import { FormPublishData } from '../_types'
|
||||
|
||||
export default function Dynamic({ content }: { content: any }): ReactElement {
|
||||
const { networkId, balance } = useWeb3()
|
||||
const { account } = useOcean()
|
||||
const { networkId, accountId, balance } = useWeb3()
|
||||
const [firstPrice, setFirstPrice] = useState<string>()
|
||||
|
||||
// Connect with form
|
||||
@ -51,14 +49,14 @@ export default function Dynamic({ content }: { content: any }): ReactElement {
|
||||
|
||||
// Check: account, network & insufficient balance
|
||||
useEffect(() => {
|
||||
if (!account) {
|
||||
if (!accountId) {
|
||||
setError(`No account connected. Please connect your Web3 wallet.`)
|
||||
} else if (Number(balance.ocean) < Number(price)) {
|
||||
setError(`Insufficient balance. You need at least ${price} OCEAN`)
|
||||
} else if (Number(balance.ocean) < Number(amountOcean)) {
|
||||
setError(`Insufficient balance. You need at least ${amountOcean} OCEAN.`)
|
||||
} else {
|
||||
setError(undefined)
|
||||
}
|
||||
}, [price, networkId, account, balance])
|
||||
}, [amountOcean, networkId, accountId, balance])
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -71,7 +69,8 @@ export default function Dynamic({ content }: { content: any }): ReactElement {
|
||||
<Price firstPrice={firstPrice} />
|
||||
|
||||
<h4 className={styles.title}>
|
||||
Datatoken Liquidity Pool <Tooltip content={content.tooltips.poolInfo} />
|
||||
Datatoken Liquidity Pool <Tooltip content={content.tooltips.poolInfo} />{' '}
|
||||
<span className={styles.subtitle}>100% share of pool</span>
|
||||
</h4>
|
||||
|
||||
<div className={styles.tokens}>
|
||||
@ -93,11 +92,6 @@ export default function Dynamic({ content }: { content: any }): ReactElement {
|
||||
|
||||
<Fees tooltips={content.tooltips} pricingType="dynamic" />
|
||||
|
||||
<footer className={styles.summary}>
|
||||
You will get: <br />
|
||||
100% share of pool
|
||||
</footer>
|
||||
|
||||
{error && (
|
||||
<div className={styles.alertArea}>
|
||||
<Alert text={error} state="error" />
|
||||
|
Loading…
Reference in New Issue
Block a user