Skip to content

Commit

Permalink
add artcpa unstaker input max button
Browse files Browse the repository at this point in the history
  • Loading branch information
michavie committed Nov 30, 2023
1 parent 0b1460e commit e03e7d0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/extensions/artcpaclub/src/esdt/EsdtTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function EsdtTab() {
)}
<_Staker pool={selectedPool} className="mb-4" />
{!!selectedPoolOnChain && selectedPoolOnChain.user_stake_amount.isGreaterThan(0) && (
<_Unstaker pool={selectedPool} className="mb-4" />
<_Unstaker pool={selectedPool} poolOnChain={selectedPoolOnChain} className="mb-4" />
)}
</>
)
Expand Down
26 changes: 14 additions & 12 deletions src/extensions/artcpaclub/src/esdt/_Unstaker.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import { EsdtPool } from '../types'
import { Contracts } from '../contracts'
import { Button, Input } from '@peerme/web-ui'
import { sanitizeNumeric } from '@peerme/core-ts'
import { EsdtPool, EsdtPoolOnChain } from '../types'
import React, { SyntheticEvent, useState } from 'react'
import { useApp } from '../../../../shared/hooks/useApp'
import { AppSection } from '../../../../shared/ui/elements'

type Props = {
pool: EsdtPool
poolOnChain: EsdtPoolOnChain
className?: string
}

export function _Unstaker(props: Props) {
const app = useApp()
const [amount, setAmount] = useState('0')
const balanceDenominated = props.poolOnChain.user_stake_amount.shiftedBy(-props.pool.stake_token_decimal)

const handleSubmit = (e: SyntheticEvent) => {
e.preventDefault()
Expand Down Expand Up @@ -43,17 +45,17 @@ export function _Unstaker(props: Props) {
className="mb-2"
autoComplete="off"
/>
{/* TODO: implement once SC data available {+amount !== +scAmount && (
<div className="absolute bottom-1/2 right-4 translate-y-1/2 transform">
<button
type="button"
onClick={() => setAmount(scAmount.toString())}
className="rounded-xl bg-gray-800 px-3 py-1 uppercase text-gray-100 shadow-lg transition duration-300 hover:bg-gray-900"
>
Max
</button>
</div>
)} */}
{+amount !== +balanceDenominated && (
<div className="absolute bottom-1/2 right-4 translate-y-1/2 transform">
<button
type="button"
onClick={() => setAmount(balanceDenominated.toString())}
className="rounded-xl bg-gray-800 px-3 py-1 uppercase text-gray-100 shadow-lg transition duration-300 hover:bg-gray-900"
>
Max
</button>
</div>
)}
</div>
<Button color="blue" className="block w-full" submit>
Add Unstake Action
Expand Down

1 comment on commit e03e7d0

@vercel
Copy link

@vercel vercel bot commented on e03e7d0 Nov 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.