Done(except referral)
This commit is contained in:
parent
3330bdae5b
commit
99fdcfc307
|
@ -122,8 +122,10 @@ export const get_page_mining = () => {
|
||||||
return getApi('v1/page_mining')
|
return getApi('v1/page_mining')
|
||||||
}
|
}
|
||||||
|
|
||||||
export const get_page_account = () => {
|
export const get_page_account = (address) => {
|
||||||
return getApi('v1/page_account')
|
return getApiWith('v1/page_account', {
|
||||||
|
address,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const get_page_team = () => {
|
export const get_page_team = () => {
|
||||||
|
@ -131,20 +133,20 @@ export const get_page_team = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const get_withdrawal_history = (address) => {
|
export const get_withdrawal_history = (address) => {
|
||||||
return getApi('v1/withdrawal_history', {
|
return getApiWith('v1/withdrawal_history', {
|
||||||
address,
|
address,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const get_daily_revenue_history = (address) => {
|
export const get_daily_revenue_history = (address) => {
|
||||||
|
|
||||||
return getApi('v1/daily_revenue_history', {
|
return getApiWith('v1/daily_revenue_history', {
|
||||||
address,
|
address,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const get_reward_history = (address) => {
|
export const get_reward_history = (address) => {
|
||||||
return getApi('v1/reward_history', {
|
return getApiWith('v1/reward_history', {
|
||||||
address,
|
address,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,23 @@ import {
|
||||||
} from '../api'
|
} from '../api'
|
||||||
import { useApp } from '../AppContext'
|
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 = [
|
let accountData = [
|
||||||
{ name: 'Total output', value: 0, emp: false, unit: 'USDT' },
|
{ name: 'Total output', value: 0, emp: false, unit: 'USDT' },
|
||||||
|
@ -21,14 +38,6 @@ let accountData = [
|
||||||
{ name: 'Withdrawal balance', value: 0, emp: false, unit: 'USDT' },
|
{ name: 'Withdrawal balance', value: 0, emp: false, unit: 'USDT' },
|
||||||
]
|
]
|
||||||
|
|
||||||
const NoData = () => (
|
|
||||||
<HStack h='20' >
|
|
||||||
<Text>
|
|
||||||
No Available Data
|
|
||||||
</Text>
|
|
||||||
</HStack>
|
|
||||||
)
|
|
||||||
|
|
||||||
export const Account = () => {
|
export const Account = () => {
|
||||||
const app = useApp()
|
const app = useApp()
|
||||||
|
|
||||||
|
@ -50,30 +59,33 @@ export const Account = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (app.address) {
|
// if (app.address) {
|
||||||
get_page_account(app.address).then(res => {
|
get_page_account('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => {
|
||||||
console.log(res.data)
|
console.log(res.data)
|
||||||
const d = res.data
|
const d = res.data
|
||||||
let newAccount = [...accountData]
|
let newAccount = [...accountData]
|
||||||
newAccount[0].value = d.output
|
newAccount[0].value = d.output
|
||||||
newAccount[1].value = d.balance
|
newAccount[1].value = d.balance
|
||||||
newAccount[2].value = d.withdrawal
|
newAccount[2].value = d.withdrawal
|
||||||
setAccountInfo(newAccount)
|
setAccountInfo(newAccount)
|
||||||
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error(err.message)
|
console.error(err.message)
|
||||||
})
|
})
|
||||||
|
|
||||||
get_withdrawal_history().then(res => {
|
get_withdrawal_history('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => {
|
||||||
console.log(res.data)
|
setWithdrawalHist(res.data)
|
||||||
})
|
console.log(res.data)
|
||||||
get_daily_revenue_history().then(res => {
|
})
|
||||||
console.log(res.data)
|
get_daily_revenue_history('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => {
|
||||||
})
|
setDailyRevenueHist(res.data)
|
||||||
get_reward_history().then(res => {
|
console.log(res.data)
|
||||||
console.log(res.data)
|
})
|
||||||
})
|
get_reward_history('0xb308ED17897105cAac3f9813DD35c2eBc64b9A65').then(res => {
|
||||||
}
|
setRewardHist(res.data)
|
||||||
|
console.log(res.data)
|
||||||
|
})
|
||||||
|
// }
|
||||||
}, [app.address])
|
}, [app.address])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -82,8 +94,8 @@ export const Account = () => {
|
||||||
|
|
||||||
<Tabs mt="4" isFitted variant="enclosed">
|
<Tabs mt="4" isFitted variant="enclosed">
|
||||||
<TabList>
|
<TabList>
|
||||||
<Tab _selected={{ color: 'white', bg: 'purple.500' }}> Withdrawal</Tab>
|
<Tab _selected={{ color: 'white', bg: 'purple.500' }} fontSize='17' fontWeight='600'> Withdrawal</Tab>
|
||||||
<Tab _selected={{ color: 'white', bg: 'purple.500' }}>Record</Tab>
|
<Tab _selected={{ color: 'white', bg: 'purple.500' }} fontSize='17' fontWeight='600'>Record</Tab>
|
||||||
</TabList>
|
</TabList>
|
||||||
|
|
||||||
<TabPanels>
|
<TabPanels>
|
||||||
|
@ -98,7 +110,7 @@ export const Account = () => {
|
||||||
<HFStack
|
<HFStack
|
||||||
p="4"
|
p="4"
|
||||||
>
|
>
|
||||||
<Text fontWeight='700'>Withdraw</Text>
|
<Text fontWeight='700'>Amount:</Text>
|
||||||
</HFStack>
|
</HFStack>
|
||||||
|
|
||||||
<HFStack
|
<HFStack
|
||||||
|
@ -174,47 +186,61 @@ export const Account = () => {
|
||||||
|
|
||||||
<TabPanels>
|
<TabPanels>
|
||||||
<TabPanel>
|
<TabPanel>
|
||||||
<HBetween>
|
{/* header */}
|
||||||
|
<THead>
|
||||||
<Text>Time</Text>
|
<Text>Time</Text>
|
||||||
<Text>Quantity</Text>
|
<Text>Quantity</Text>
|
||||||
<Text>Status</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>
|
||||||
|
|
||||||
<TabPanel>
|
<TabPanel>
|
||||||
<HBetween>
|
<THead>
|
||||||
<Text>Time</Text>
|
<Text>Time</Text>
|
||||||
<Text>Quantity</Text>
|
<Text>Quantity</Text>
|
||||||
<Text>Type</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>
|
||||||
|
|
||||||
<TabPanel>
|
<TabPanel>
|
||||||
<HBetween>
|
<THead>
|
||||||
<Text>Time</Text>
|
<Text>Time</Text>
|
||||||
<Text>Quantity</Text>
|
<Text>Quantity</Text>
|
||||||
<Text>User Address</Text>
|
<Text>User Address</Text>
|
||||||
</HBetween>
|
</THead>
|
||||||
{
|
{
|
||||||
rewardHist ?
|
rewardHist.length ?
|
||||||
<>
|
<>
|
||||||
</>
|
</>
|
||||||
:
|
:
|
||||||
'No Data.'
|
<NoData />
|
||||||
}
|
}
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
</TabPanels>
|
</TabPanels>
|
||||||
|
|
Loading…
Reference in New Issue