Done(except referral)

This commit is contained in:
john 2022-05-19 11:13:46 +07:00
parent 3330bdae5b
commit 99fdcfc307
2 changed files with 82 additions and 54 deletions

View File

@ -122,8 +122,10 @@ export const get_page_mining = () => {
return getApi('v1/page_mining')
}
export const get_page_account = () => {
return getApi('v1/page_account')
export const get_page_account = (address) => {
return getApiWith('v1/page_account', {
address,
})
}
export const get_page_team = () => {
@ -131,20 +133,20 @@ export const get_page_team = () => {
}
export const get_withdrawal_history = (address) => {
return getApi('v1/withdrawal_history', {
return getApiWith('v1/withdrawal_history', {
address,
})
}
export const get_daily_revenue_history = (address) => {
return getApi('v1/daily_revenue_history', {
return getApiWith('v1/daily_revenue_history', {
address,
})
}
export const get_reward_history = (address) => {
return getApi('v1/reward_history', {
return getApiWith('v1/reward_history', {
address,
})
}

View File

@ -14,6 +14,23 @@ import {
} from '../api'
import { useApp } from '../AppContext'
const NoData = () => (<Center py='6'><Text>No Data</Text></Center>)
const THead = ({ children }) => (<HBetween color='gray.400' fontWeight='600' borderBottomWidth='1px'>{children}</HBetween>)
const TRow = ({ children }) => (
<HBetween color='gray.600' fontWeight='500' borderBottomWidth='1px' borderColor='gray.100' p='1'>
{children}
</HBetween>
)
const WithdrawStatus = (status) => {
if (status == 0) {
return <Badge colorScheme='cyan' variant="solid" >Processing</Badge>
} else if (status == 1) {
return <Badge colorScheme='green' variant="solid" >Done</Badge>
} else if (status == 2) {
return <Badge colorScheme='red' variant="solid" >Rejected</Badge>
}
}
let accountData = [
{ name: 'Total output', value: 0, emp: false, unit: 'USDT' },
@ -21,14 +38,6 @@ let accountData = [
{ name: 'Withdrawal balance', value: 0, emp: false, unit: 'USDT' },
]
const NoData = () => (
<HStack h='20' >
<Text>
No Available Data
</Text>
</HStack>
)
export const Account = () => {
const app = useApp()
@ -50,8 +59,8 @@ export const Account = () => {
}
React.useEffect(() => {
if (app.address) {
get_page_account(app.address).then(res => {
// if (app.address) {
get_page_account('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => {
console.log(res.data)
const d = res.data
let newAccount = [...accountData]
@ -64,16 +73,19 @@ export const Account = () => {
console.error(err.message)
})
get_withdrawal_history().then(res => {
get_withdrawal_history('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => {
setWithdrawalHist(res.data)
console.log(res.data)
})
get_daily_revenue_history().then(res => {
get_daily_revenue_history('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => {
setDailyRevenueHist(res.data)
console.log(res.data)
})
get_reward_history().then(res => {
get_reward_history('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => {
setRewardHist(res.data)
console.log(res.data)
})
}
// }
}, [app.address])
return (
@ -82,8 +94,8 @@ export const Account = () => {
<Tabs mt="4" isFitted variant="enclosed">
<TabList>
<Tab _selected={{ color: 'white', bg: 'purple.500' }}> Withdrawal</Tab>
<Tab _selected={{ color: 'white', bg: 'purple.500' }}>Record</Tab>
<Tab _selected={{ color: 'white', bg: 'purple.500' }} fontSize='17' fontWeight='600'> Withdrawal</Tab>
<Tab _selected={{ color: 'white', bg: 'purple.500' }} fontSize='17' fontWeight='600'>Record</Tab>
</TabList>
<TabPanels>
@ -98,7 +110,7 @@ export const Account = () => {
<HFStack
p="4"
>
<Text fontWeight='700'>Withdraw</Text>
<Text fontWeight='700'>Amount:</Text>
</HFStack>
<HFStack
@ -174,47 +186,61 @@ export const Account = () => {
<TabPanels>
<TabPanel>
<HBetween>
{/* header */}
<THead>
<Text>Time</Text>
<Text>Quantity</Text>
<Text>Status</Text>
</HBetween>
</THead>
{
withdrawalHist ?
<>
</>
withdrawalHist.length ?
withdrawalHist.map(h => (
<TRow key={h.id}>
<Text>{h.created_at.substring(0, 10)}</Text>
<Text>{h.true_balance || 0}</Text>
{
WithdrawStatus(h.status)
}
</TRow>
))
:
'No Data.'
<NoData />
}
</TabPanel>
<TabPanel>
<HBetween>
<THead>
<Text>Time</Text>
<Text>Quantity</Text>
<Text>Type</Text>
</HBetween>
</THead>
{
dailyRevenueHist ?
<>
</>
dailyRevenueHist.length ?
dailyRevenueHist.map(h => (
<TRow key={h.id}>
<Text>{h.created_at.substring(0, 10)}</Text>
<Text>{h.money || 0}</Text>
<Badge colorScheme='green' variant='solid'>Claimed</Badge>
</TRow>
))
:
'No Data.'
<NoData />
}
</TabPanel>
<TabPanel>
<HBetween>
<THead>
<Text>Time</Text>
<Text>Quantity</Text>
<Text>User Address</Text>
</HBetween>
</THead>
{
rewardHist ?
rewardHist.length ?
<>
</>
:
'No Data.'
<NoData />
}
</TabPanel>
</TabPanels>