调整军团长
This commit is contained in:
parent
5e9b7e99a1
commit
1442fdbbaa
|
|
@ -30,7 +30,7 @@ export const getWithdrawRewardParams = () => {
|
||||||
export const checkBuyResult = (params) => {
|
export const checkBuyResult = (params) => {
|
||||||
return request.request({
|
return request.request({
|
||||||
url: '/high_city/app/api/invite/commander/tx',
|
url: '/high_city/app/api/invite/commander/tx',
|
||||||
method: 'post',
|
method: 'get',
|
||||||
params,
|
params,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
import React from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import { formatDivNumber } from 'utils/formatBalance'
|
import { formatDivNumber } from 'utils/formatBalance'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import { useReferralNormalConfigInfo, useReferralCommanderConfigInfo } from 'state/referral/hooks'
|
import { useReferralNormalConfigInfo, useReferralCommanderConfigInfo } from 'state/referral/hooks'
|
||||||
import { Flex, Button, Modal, Image } from '@pancakeswap/uikit'
|
import { Flex, Button, Modal, Image, Text } from '@pancakeswap/uikit'
|
||||||
import BuyActions from './BuyActions'
|
import BuyActions from './BuyActions'
|
||||||
import TextFlex from './TextFlex'
|
import TextFlex from './TextFlex'
|
||||||
import FlexCom from './FlexCom'
|
import FlexCom from './FlexCom'
|
||||||
|
|
||||||
const ModalDiv = styled(Modal)`
|
const ModalDiv = styled(Modal)`
|
||||||
width: 80%;
|
width: 60%;
|
||||||
|
|
||||||
${({ theme }) => theme.mediaQueries.xs} {
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
}
|
}
|
||||||
|
|
@ -43,6 +43,20 @@ const ImageDiv = styled(Image)`
|
||||||
height: 300px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
const TextDiv = styled(Text)`
|
||||||
|
width: 240px;
|
||||||
|
height: 45px;
|
||||||
|
background: #d7caec;
|
||||||
|
border: 1px solid #d7caec;
|
||||||
|
opacity: 0.5;
|
||||||
|
border-radius: 23px;
|
||||||
|
font-size: 18px;
|
||||||
|
color: #280d5f;
|
||||||
|
padding-left: 15px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
`
|
||||||
|
|
||||||
interface BuyNftModalProps {
|
interface BuyNftModalProps {
|
||||||
onDismiss?: () => void
|
onDismiss?: () => void
|
||||||
}
|
}
|
||||||
|
|
@ -50,15 +64,29 @@ const BuyNftModal: React.FC<BuyNftModalProps> = ({ onDismiss }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const referralCommanderConfigInfo = useReferralCommanderConfigInfo()
|
const referralCommanderConfigInfo = useReferralCommanderConfigInfo()
|
||||||
const referralRewardInfo = useReferralNormalConfigInfo()
|
const referralRewardInfo = useReferralNormalConfigInfo()
|
||||||
|
const [price, setPrice] = useState('')
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const priceList = []
|
||||||
|
referralCommanderConfigInfo?.properties?.price &&
|
||||||
|
Object.keys(referralCommanderConfigInfo?.properties?.price).forEach((item) => {
|
||||||
|
priceList.push(`${item}:${referralCommanderConfigInfo?.properties?.price[item]}`)
|
||||||
|
})
|
||||||
|
setPrice(priceList.join(' - '))
|
||||||
|
}, [referralCommanderConfigInfo])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ModalDiv title={`${t('purchase')}${referralRewardInfo.properties?.name}`} onDismiss={onDismiss}>
|
<ModalDiv title={`${t('purchase')}${referralRewardInfo.properties?.name}`} onDismiss={onDismiss}>
|
||||||
<Flex alignItems="center" flexWrap="wrap" justifyContent="center">
|
<Flex alignItems="center" flexWrap="wrap" justifyContent="center">
|
||||||
<ImageDiv
|
<Flex flexDirection="column" justifyContent="center">
|
||||||
src={referralCommanderConfigInfo.properties?.cover as string}
|
<ImageDiv
|
||||||
width={250}
|
src={referralCommanderConfigInfo.properties?.cover as string}
|
||||||
height={250}
|
width={250}
|
||||||
marginBottom="20px"
|
height={250}
|
||||||
/>
|
marginBottom="20px"
|
||||||
|
/>
|
||||||
|
<TextDiv>{price}</TextDiv>
|
||||||
|
</Flex>
|
||||||
{/* <ImageDiv src="/images/recommend/logo.svg" width={250} height={250} marginBottom="20px" /> */}
|
{/* <ImageDiv src="/images/recommend/logo.svg" width={250} height={250} marginBottom="20px" /> */}
|
||||||
<InfoDiv>
|
<InfoDiv>
|
||||||
<TextFlex
|
<TextFlex
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import { useDispatch } from 'react-redux'
|
import { useDispatch } from 'react-redux'
|
||||||
import { fetchReferralInfoAsync } from 'state/actions'
|
import { fetchReferralInfoAsync } from 'state/actions'
|
||||||
|
|
@ -61,18 +61,21 @@ const ConnectedCom: React.FC = () => {
|
||||||
const account = useAccount()
|
const account = useAccount()
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const [onBuyModal] = useModal(<BuyNftModal />)
|
const [onBuyModal] = useModal(<BuyNftModal />)
|
||||||
|
const [gain, getGain] = useState(true)
|
||||||
const referralNormalConfigInfo = useReferralNormalConfigInfo()
|
const referralNormalConfigInfo = useReferralNormalConfigInfo()
|
||||||
const referralRewardInfo = useReferralRewardInfo()
|
const referralRewardInfo = useReferralRewardInfo()
|
||||||
|
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const withdraw = useWithdraw()
|
const withdraw = useWithdraw()
|
||||||
const { toastSuccess } = useToast()
|
const { toastSuccess } = useToast()
|
||||||
const handleWithdraw = async () => {
|
const handleWithdraw = async () => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
try {
|
try {
|
||||||
await withdraw()
|
|
||||||
dispatch(fetchReferralInfoAsync(account))
|
dispatch(fetchReferralInfoAsync(account))
|
||||||
|
await withdraw()
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
toastSuccess(t('Successfully claimed!'))
|
toastSuccess(t('Successfully claimed!'))
|
||||||
|
getGain(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|
@ -85,12 +88,12 @@ const ConnectedCom: React.FC = () => {
|
||||||
<FlexCom name={t('HCC total revenue')} value={`${referralRewardInfo?.inviteReward || 0}(HCC)`} />
|
<FlexCom name={t('HCC total revenue')} value={`${referralRewardInfo?.inviteReward || 0}(HCC)`} />
|
||||||
<FlexCom
|
<FlexCom
|
||||||
name={t('To get profit')}
|
name={t('To get profit')}
|
||||||
value={`${referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive || 0}(HCC)`}
|
value={`${gain ? referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive || 0 : 0}(HCC)`}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
<FooterBtn>
|
<FooterBtn>
|
||||||
{referralNormalConfigInfo?.receiveLimit <=
|
{referralNormalConfigInfo?.receiveLimit <=
|
||||||
referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive ? (
|
referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive && gain ? (
|
||||||
<ButtonGet onClick={handleWithdraw} disabled={loading} variant="secondary">
|
<ButtonGet onClick={handleWithdraw} disabled={loading} variant="secondary">
|
||||||
{t('Claim now')}
|
{t('Claim now')}
|
||||||
</ButtonGet>
|
</ButtonGet>
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ const ContentDiv = styled.div`
|
||||||
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16);
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16);
|
||||||
border-radius: 40px;
|
border-radius: 40px;
|
||||||
|
|
||||||
${({ theme }) => theme.mediaQueries.sm} {
|
/* ${({ theme }) => theme.mediaQueries.sm} {
|
||||||
width: 60%;
|
width: 60%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -32,8 +32,8 @@ const ContentDiv = styled.div`
|
||||||
width: 60%;
|
width: 60%;
|
||||||
}
|
}
|
||||||
${({ theme }) => theme.mediaQueries.xs} {
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
width: 90%;
|
width: 60%;
|
||||||
}
|
} */
|
||||||
`
|
`
|
||||||
|
|
||||||
const Nft: React.FC = () => {
|
const Nft: React.FC = () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue