import {
Text, Button, Tab, TabList, TabPanel, TabPanels,
Tabs, Center, Input, Divider, Image,
Badge, Icon, StackDivider, HStack,
} from '@chakra-ui/react'
import React from 'react'
import { HBetween, HFStack, PoolData, VFStack } from '../components'
import { Images } from '../data'
import {
get_page_account, post_withdraw,
get_withdrawal_history,
get_daily_revenue_history,
get_reward_history,
} from '../api'
import { useApp } from '../AppContext'
let accountData = [
{ name: 'Total output', value: 0, emp: false, unit: 'USDT' },
{ name: 'Wallet balance', value: 0, emp: false, unit: 'USDT' },
{ name: 'Withdrawal balance', value: 0, emp: false, unit: 'USDT' },
]
const NoData = () => (
No Available Data
)
export const Account = () => {
const app = useApp()
const [accountInfo, setAccountInfo] = React.useState(accountData)
const [withdrawalHist, setWithdrawalHist] = React.useState([])
const [dailyRevenueHist, setDailyRevenueHist] = React.useState([])
const [rewardHist, setRewardHist] = React.useState([])
const [withdrawalAmount, setWithdrawalAmount] = React.useState(0)
const onBtnConfirm = () => {
if (app.address && withdrawalAmount > 0) {
post_withdraw(app.address, withdrawalAmount).then(res => {
}).catch(err => {
console.error(err.message)
})
}
}
React.useEffect(() => {
if (app.address) {
get_page_account(app.address).then(res => {
console.log(res.data)
const d = res.data
let newAccount = [...accountData]
newAccount[0].value = d.output
newAccount[1].value = d.balance
newAccount[2].value = d.withdrawal
setAccountInfo(newAccount)
}).catch(err => {
console.error(err.message)
})
get_withdrawal_history().then(res => {
console.log(res.data)
})
get_daily_revenue_history().then(res => {
console.log(res.data)
})
get_reward_history().then(res => {
console.log(res.data)
})
}
}, [app.address])
return (
<>
Withdrawal
Record
Withdraw
}
>
{
setWithdrawalAmount(ev.target.value)
}}
/>
{
setWithdrawalAmount(accountInfo[1].value)
}}
>
Redeem all
USDT
Your withdrawal will be sent to you USDT wallet address within 24 hours.
Withdraw
DailyRevenue
Reward
Time
Quantity
Status
{
withdrawalHist ?
<>
>
:
'No Data.'
}
Time
Quantity
Type
{
dailyRevenueHist ?
<>
>
:
'No Data.'
}
Time
Quantity
User Address
{
rewardHist ?
<>
>
:
'No Data.'
}
>
)
}