mirror of
https://github.com/oceanprotocol/market.git
synced 2024-11-15 01:34:57 +01:00
remove liquidity screen styling
This commit is contained in:
parent
93b7b1b6c2
commit
fb479a167f
@ -1,4 +1,11 @@
|
|||||||
.removeInput {
|
.removeInput {
|
||||||
max-width: 12rem;
|
composes: addInput from './Add.module.css';
|
||||||
margin: 0 auto var(--spacer) auto;
|
}
|
||||||
|
|
||||||
|
.buttonMax {
|
||||||
|
composes: buttonMax from './Add.module.css';
|
||||||
|
}
|
||||||
|
|
||||||
|
.userBalance {
|
||||||
|
composes: userBalance from './Add.module.css';
|
||||||
}
|
}
|
||||||
|
@ -5,15 +5,21 @@ import Header from './Header'
|
|||||||
import { toast } from 'react-toastify'
|
import { toast } from 'react-toastify'
|
||||||
import InputElement from '../../../atoms/Input/InputElement'
|
import InputElement from '../../../atoms/Input/InputElement'
|
||||||
import Actions from './Actions'
|
import Actions from './Actions'
|
||||||
|
import { Logger } from '@oceanprotocol/lib'
|
||||||
|
import Button from '../../../atoms/Button'
|
||||||
|
import PriceUnit from '../../../atoms/Price/PriceUnit'
|
||||||
|
import { Balance } from '.'
|
||||||
|
|
||||||
export default function Remove({
|
export default function Remove({
|
||||||
setShowRemove,
|
setShowRemove,
|
||||||
poolAddress,
|
poolAddress,
|
||||||
totalPoolTokens
|
totalPoolTokens,
|
||||||
|
userBalance
|
||||||
}: {
|
}: {
|
||||||
setShowRemove: (show: boolean) => void
|
setShowRemove: (show: boolean) => void
|
||||||
poolAddress: string
|
poolAddress: string
|
||||||
totalPoolTokens: string
|
totalPoolTokens: string
|
||||||
|
userBalance: Balance
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { ocean, accountId } = useOcean()
|
const { ocean, accountId } = useOcean()
|
||||||
const [amount, setAmount] = useState('')
|
const [amount, setAmount] = useState('')
|
||||||
@ -32,7 +38,7 @@ export default function Remove({
|
|||||||
)
|
)
|
||||||
setTxId(result.transactionHash)
|
setTxId(result.transactionHash)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error.message)
|
Logger.error(error.message)
|
||||||
toast.error(error.message)
|
toast.error(error.message)
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false)
|
setIsLoading(false)
|
||||||
@ -43,6 +49,10 @@ export default function Remove({
|
|||||||
setAmount(e.target.value)
|
setAmount(e.target.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleMax() {
|
||||||
|
setAmount(userBalance.ocean)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.remove}>
|
<div className={styles.remove}>
|
||||||
<Header
|
<Header
|
||||||
@ -50,7 +60,11 @@ export default function Remove({
|
|||||||
backAction={() => setShowRemove(false)}
|
backAction={() => setShowRemove(false)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className={styles.removeInput}>
|
<form className={styles.removeInput}>
|
||||||
|
<div className={styles.userBalance}>
|
||||||
|
<span>Your pool liquidity: </span>
|
||||||
|
<PriceUnit price={userBalance.ocean} symbol="OCEAN" small />
|
||||||
|
</div>
|
||||||
<InputElement
|
<InputElement
|
||||||
value={amount}
|
value={amount}
|
||||||
name="ocean"
|
name="ocean"
|
||||||
@ -59,7 +73,18 @@ export default function Remove({
|
|||||||
placeholder="0"
|
placeholder="0"
|
||||||
onChange={handleAmountChange}
|
onChange={handleAmountChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
|
{userBalance.ocean > amount && (
|
||||||
|
<Button
|
||||||
|
className={styles.buttonMax}
|
||||||
|
style="text"
|
||||||
|
size="small"
|
||||||
|
onClick={handleMax}
|
||||||
|
>
|
||||||
|
Use Max
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</form>
|
||||||
|
|
||||||
{/* <Input name="dt" label={dtSymbol} type="number" placeholder="0" /> */}
|
{/* <Input name="dt" label={dtSymbol} type="number" placeholder="0" /> */}
|
||||||
|
|
||||||
|
@ -126,6 +126,7 @@ export default function Pool({ ddo }: { ddo: DDO }): ReactElement {
|
|||||||
setShowRemove={setShowRemove}
|
setShowRemove={setShowRemove}
|
||||||
poolAddress={price.address}
|
poolAddress={price.address}
|
||||||
totalPoolTokens={totalPoolTokens}
|
totalPoolTokens={totalPoolTokens}
|
||||||
|
userBalance={userBalance}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
Loading…
Reference in New Issue
Block a user