commit
2d40956577
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 689 KiB After Width: | Height: | Size: 424 KiB |
|
|
@ -116,7 +116,7 @@
|
||||||
"Total jackpot this round": "此回合的总累积奖池",
|
"Total jackpot this round": "此回合的总累积奖池",
|
||||||
"Collect Winnings": "收集奖金",
|
"Collect Winnings": "收集奖金",
|
||||||
"Buy Tickets": "购买彩票",
|
"Buy Tickets": "购买彩票",
|
||||||
"Harvest": "收割",
|
"Harvest": "领取收益",
|
||||||
"Approve": "批准",
|
"Approve": "批准",
|
||||||
"Select": "选择",
|
"Select": "选择",
|
||||||
"Winning Numbers This Round": "此回合的中奖号码",
|
"Winning Numbers This Round": "此回合的中奖号码",
|
||||||
|
|
@ -217,7 +217,7 @@
|
||||||
"Prize Pot": "奖金池",
|
"Prize Pot": "奖金池",
|
||||||
"Winners": "获胜者",
|
"Winners": "获胜者",
|
||||||
"No. Matched": "中的号码数",
|
"No. Matched": "中的号码数",
|
||||||
"Approve Contract": "批准合约",
|
"Approve %coin% Contract": "批准 %coin% 合约",
|
||||||
"%asset% staked": "%asset% 已质押",
|
"%asset% staked": "%asset% 已质押",
|
||||||
"Total Value Locked": "锁定的总价值",
|
"Total Value Locked": "锁定的总价值",
|
||||||
"Across all LPs and Syrup Pools": "在所有 LP 和 Syrup 资金池中",
|
"Across all LPs and Syrup Pools": "在所有 LP 和 Syrup 资金池中",
|
||||||
|
|
@ -1117,6 +1117,7 @@
|
||||||
"Enter a keyword search": "输入关键字搜索",
|
"Enter a keyword search": "输入关键字搜索",
|
||||||
"By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins": "使用页面右上方的邀请,可邀请新用户进入,并在用户购买币后获得",
|
"By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins": "使用页面右上方的邀请,可邀请新用户进入,并在用户购买币后获得",
|
||||||
"The commission": "的提成!",
|
"The commission": "的提成!",
|
||||||
|
"footer %number% text": "使用页面右上方的邀请,可邀请新用户进入,并在用户购买币后获得 %number% 的提成!",
|
||||||
"market value": "市值",
|
"market value": "市值",
|
||||||
"Loaded all": "已加载全部",
|
"Loaded all": "已加载全部",
|
||||||
"Insufficient Balance": "余额不足",
|
"Insufficient Balance": "余额不足",
|
||||||
|
|
@ -1126,5 +1127,31 @@
|
||||||
"capital pool": "资金池",
|
"capital pool": "资金池",
|
||||||
"Unclaimed income": "待领取收益",
|
"Unclaimed income": "待领取收益",
|
||||||
"pledge": "质押",
|
"pledge": "质押",
|
||||||
"Invite": "邀请"
|
"Invite": "邀请",
|
||||||
|
"top": "置顶",
|
||||||
|
"Cancel the pledge": "取消质押",
|
||||||
|
"Forced to cancel": "强制取消质押",
|
||||||
|
"End of the lock up": "锁仓结束",
|
||||||
|
"Get the benefits": "领取收益",
|
||||||
|
"license agreement": "授权合约",
|
||||||
|
"Minimum amount pledged": "最小质押金额",
|
||||||
|
"Holder": "持币人",
|
||||||
|
"Board": "董事会",
|
||||||
|
"Whether to cancel": "是否取消",
|
||||||
|
"Please enter a number": "请输入数字",
|
||||||
|
"my wallet": "我的钱包",
|
||||||
|
"Copy the address": "复制地址",
|
||||||
|
"How to use": "如何使用",
|
||||||
|
"person": "人",
|
||||||
|
"Earnings will be cleared after forced cancellation. Confirm cancellation": "强制取消后收益将清空,是否确认取消",
|
||||||
|
"HighCitySwapInfo": "HIighCitySwap的诞生,源于创始人Liu Bus对区块链技术的狂热追求,他始终相信区块链技术能够得到更广泛的应用。为此,他做了一个勇敢的决定,放弃在其他领域的投资,身心专注投入到区块链技术实践应用当中去,将自己所熟悉的领域——互联网社交,与区块链技术融合,HighCitySwap由此诞生。这就是我们的开始,感谢你们的支持,HighCity团队将永远前行。",
|
||||||
|
"After pledge, income will lock warehouse%times%": "质押后,收益将锁仓%times%",
|
||||||
|
"IDO exchange in the first phase": "第一期IDO兑换",
|
||||||
|
"Opening time of next exchange period:": "下期兑换开启时间:",
|
||||||
|
"Please enter the amount": "请输入金额",
|
||||||
|
"Exchange rate": "兑换比率",
|
||||||
|
"gross": "总量",
|
||||||
|
"remaining quantity": "剩余数量",
|
||||||
|
"Immediately change": "立即兑换",
|
||||||
|
"IDO Exchange": "IDO 兑换"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ const Referral = lazy(() => import('./views/Referral'))
|
||||||
const Board = lazy(() => import('./views/Board'))
|
const Board = lazy(() => import('./views/Board'))
|
||||||
const Nft = lazy(() => import('./views/Nft'))
|
const Nft = lazy(() => import('./views/Nft'))
|
||||||
const Announcement = lazy(() => import('./views/Announcement'))
|
const Announcement = lazy(() => import('./views/Announcement'))
|
||||||
|
const Exchange = lazy(() => import('./views/Exchange'))
|
||||||
|
|
||||||
// This config is required for number formatting
|
// This config is required for number formatting
|
||||||
BigNumber.config({
|
BigNumber.config({
|
||||||
|
|
@ -99,6 +100,9 @@ const App: React.FC = () => {
|
||||||
<Route path="/pools">
|
<Route path="/pools">
|
||||||
<Pools />
|
<Pools />
|
||||||
</Route>
|
</Route>
|
||||||
|
<Route path="/exchange">
|
||||||
|
<Exchange />
|
||||||
|
</Route>
|
||||||
<Route path="/referral">
|
<Route path="/referral">
|
||||||
<Referral />
|
<Referral />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,11 @@ const config: (t: ContextApi['t']) => MenuEntry[] = (t) => [
|
||||||
// // },
|
// // },
|
||||||
// ],
|
// ],
|
||||||
// },
|
// },
|
||||||
|
{
|
||||||
|
label: t('IDO Exchange'),
|
||||||
|
icon: 'FarmIcon',
|
||||||
|
href: '/exchange',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t('Exchange'),
|
label: t('Exchange'),
|
||||||
icon: 'FarmIcon',
|
icon: 'FarmIcon',
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ const Menu = (props) => {
|
||||||
const links = Object.keys(item.linkMap).map((key) => {
|
const links = Object.keys(item.linkMap).map((key) => {
|
||||||
return { name: key, link: item.linkMap[key], icon: item.iconResource.url }
|
return { name: key, link: item.linkMap[key], icon: item.iconResource.url }
|
||||||
})
|
})
|
||||||
return { icon: item.iconResource.url, list: links, key: index + item.name }
|
return { icon: item.iconResource.url, list: links, key: index + item.name, name: item.name }
|
||||||
})
|
})
|
||||||
setSocialLink(list)
|
setSocialLink(list)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,9 @@
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{ "internalType": "uint256", "name": "accHCCPerShare", "type": "uint256" },
|
{ "internalType": "uint256", "name": "accHCCPerShare", "type": "uint256" },
|
||||||
{ "internalType": "uint256", "name": "totalAmount", "type": "uint256" },
|
{ "internalType": "uint256", "name": "totalAmount", "type": "uint256" },
|
||||||
{ "internalType": "uint256", "name": "num", "type": "uint256" }
|
{ "internalType": "uint256", "name": "totalReward", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "curAmount", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "holderNum", "type": "uint256" }
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
|
|
@ -177,7 +179,8 @@
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
|
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
|
||||||
{ "internalType": "uint256", "name": "rewardDebt", "type": "uint256" },
|
{ "internalType": "uint256", "name": "rewardDebt", "type": "uint256" },
|
||||||
{ "internalType": "uint256", "name": "unLockTime", "type": "uint256" }
|
{ "internalType": "uint256", "name": "unLockTime", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "receiveReward", "type": "uint256" }
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,9 @@
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{ "internalType": "uint256", "name": "accHCCPerShare", "type": "uint256" },
|
{ "internalType": "uint256", "name": "accHCCPerShare", "type": "uint256" },
|
||||||
{ "internalType": "uint256", "name": "totalAmount", "type": "uint256" },
|
{ "internalType": "uint256", "name": "totalAmount", "type": "uint256" },
|
||||||
{ "internalType": "uint256", "name": "num", "type": "uint256" }
|
{ "internalType": "uint256", "name": "totalReward", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "curAmount", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "holderNum", "type": "uint256" }
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
|
|
@ -162,7 +164,8 @@
|
||||||
"name": "userInfo",
|
"name": "userInfo",
|
||||||
"outputs": [
|
"outputs": [
|
||||||
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
|
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
|
||||||
{ "internalType": "uint256", "name": "rewardDebt", "type": "uint256" }
|
{ "internalType": "uint256", "name": "rewardDebt", "type": "uint256" },
|
||||||
|
{ "internalType": "uint256", "name": "receiveReward", "type": "uint256" }
|
||||||
],
|
],
|
||||||
"stateMutability": "view",
|
"stateMutability": "view",
|
||||||
"type": "function"
|
"type": "function"
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export default {
|
||||||
56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95',
|
56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95',
|
||||||
},
|
},
|
||||||
boardChef: {
|
boardChef: {
|
||||||
97: '0x0e28f80e6560f0ebbba4bbdf155a946053e5056a',
|
97: '0x126935cae1988efbf8e310abe6be1f9046eaf0ac',
|
||||||
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
|
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约
|
||||||
},
|
},
|
||||||
boardRewardChef: {
|
boardRewardChef: {
|
||||||
|
|
@ -16,7 +16,7 @@ export default {
|
||||||
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会分红合约
|
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会分红合约
|
||||||
},
|
},
|
||||||
holderChef: {
|
holderChef: {
|
||||||
97: '0xafa64f22a09fc197949c45281b2ad381a2b623a3',
|
97: '0x8faafb4ba8945917e7fe024dbbad0a5fb1da2181',
|
||||||
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 持币人
|
56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 持币人
|
||||||
},
|
},
|
||||||
holderRewardChef: {
|
holderRewardChef: {
|
||||||
|
|
|
||||||
|
|
@ -30,34 +30,34 @@ export const ZHCN: Language = { locale: 'zh-CN', language: '简体中文', code:
|
||||||
export const ZHTW: Language = { locale: 'zh-TW', language: '繁體中文', code: 'zh-tw' }
|
export const ZHTW: Language = { locale: 'zh-TW', language: '繁體中文', code: 'zh-tw' }
|
||||||
|
|
||||||
export const languages = {
|
export const languages = {
|
||||||
// 'ar-SA': AR,
|
'ar-SA': AR,
|
||||||
// 'bn-BD': BN,
|
'bn-BD': BN,
|
||||||
'en-US': EN,
|
'en-US': EN,
|
||||||
// 'de-DE': DE,
|
'de-DE': DE,
|
||||||
// 'el-GR': EL,
|
'el-GR': EL,
|
||||||
// 'es-ES': ESES,
|
'es-ES': ESES,
|
||||||
// 'fi-FI': FI,
|
'fi-FI': FI,
|
||||||
// 'fil-PH': FIL,
|
'fil-PH': FIL,
|
||||||
// 'fr-FR': FR,
|
'fr-FR': FR,
|
||||||
// 'hi-IN': HI,
|
'hi-IN': HI,
|
||||||
// 'hu-HU': HU,
|
'hu-HU': HU,
|
||||||
// 'id-ID': ID,
|
'id-ID': ID,
|
||||||
// 'it-IT': IT,
|
'it-IT': IT,
|
||||||
// 'ja-JP': JA,
|
'ja-JP': JA,
|
||||||
// 'ko-KR': KO,
|
'ko-KR': KO,
|
||||||
// 'nl-NL': NL,
|
'nl-NL': NL,
|
||||||
// 'pl-PL': PL,
|
'pl-PL': PL,
|
||||||
// 'pt-BR': PTBR,
|
'pt-BR': PTBR,
|
||||||
// 'pt-PT': PTPT,
|
'pt-PT': PTPT,
|
||||||
// 'ro-RO': RO,
|
'ro-RO': RO,
|
||||||
// 'ru-RU': RU,
|
'ru-RU': RU,
|
||||||
// 'sv-SE': SVSE,
|
'sv-SE': SVSE,
|
||||||
// 'ta-IN': TA,
|
'ta-IN': TA,
|
||||||
// 'tr-TR': TR,
|
'tr-TR': TR,
|
||||||
// 'uk-UA': UK,
|
'uk-UA': UK,
|
||||||
// 'vi-VN': VI,
|
'vi-VN': VI,
|
||||||
'zh-CN': ZHCN,
|
'zh-CN': ZHCN,
|
||||||
// 'zh-TW': ZHTW,
|
'zh-TW': ZHTW,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const languageList = Object.values(languages)
|
export const languageList = Object.values(languages)
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@
|
||||||
"Prize Pot": "Prize Pot",
|
"Prize Pot": "Prize Pot",
|
||||||
"Winners": "Winners",
|
"Winners": "Winners",
|
||||||
"No. Matched": "No. Matched",
|
"No. Matched": "No. Matched",
|
||||||
"Approve Contract": "Approve Contract",
|
"Approve %coin% Contract": "Approve %coin% Contract",
|
||||||
"%asset% staked": "%asset% staked",
|
"%asset% staked": "%asset% staked",
|
||||||
"Total Value Locked": "Total Value Locked",
|
"Total Value Locked": "Total Value Locked",
|
||||||
"Across all LPs and Syrup Pools": "Across all LPs and Syrup Pools",
|
"Across all LPs and Syrup Pools": "Across all LPs and Syrup Pools",
|
||||||
|
|
@ -1246,6 +1246,7 @@
|
||||||
"Enter a keyword search": "Enter a keyword search",
|
"Enter a keyword search": "Enter a keyword search",
|
||||||
"By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins": "By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins",
|
"By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins": "By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins",
|
||||||
"The commission": "The commission!",
|
"The commission": "The commission!",
|
||||||
|
"footer %number% text": "By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins %number% The commission!",
|
||||||
"market value": "market value",
|
"market value": "market value",
|
||||||
"Loaded all": "Loaded all",
|
"Loaded all": "Loaded all",
|
||||||
"HCC Currency amount": "HCC Currency amount",
|
"HCC Currency amount": "HCC Currency amount",
|
||||||
|
|
@ -1253,5 +1254,31 @@
|
||||||
"possess LP": "possess LP",
|
"possess LP": "possess LP",
|
||||||
"capital pool": "capital pool",
|
"capital pool": "capital pool",
|
||||||
"Unclaimed income": "Unclaimed income",
|
"Unclaimed income": "Unclaimed income",
|
||||||
"pledge": "pledge"
|
"pledge": "pledge",
|
||||||
|
"top": "top",
|
||||||
|
"Cancel the pledge": "Cancel the pledge",
|
||||||
|
"Forced to cancel": "Forced to cancel",
|
||||||
|
"End of the lock up": "End of the lock up",
|
||||||
|
"Get the benefits": "Get the benefits",
|
||||||
|
"license agreement": "license agreement",
|
||||||
|
"Minimum amount pledged": "Minimum amount pledged",
|
||||||
|
"Holder": "Holder",
|
||||||
|
"Board": "Board",
|
||||||
|
"Whether to cancel": "Whether to cancel",
|
||||||
|
"Please enter a number": "Please enter a number",
|
||||||
|
"my wallet": "my wallet",
|
||||||
|
"Copy the address": "Copy the address",
|
||||||
|
"How to use": "How to use",
|
||||||
|
"person": "person",
|
||||||
|
"Earnings will be cleared after forced cancellation. Confirm cancellation": "Earnings will be cleared after forced cancellation. Confirm cancellation",
|
||||||
|
"HighCitySwapInfo": "HIighCitySwap was born from the fanatical pursuit of blockchain technology by its founder Liu Bus, who always believes that blockchain technology can be applied more widely. For this reason, he made a brave decision to give up investment in other fields and focus on the practice and application of blockchain technology. He fused his familiar field -- Internet social interaction with blockchain technology and thus HighCitySwap was born. This is our beginning, thank you for your support, the HighCity team will always move forward.",
|
||||||
|
"After pledge, income will lock warehouse%times%": "After pledge, income will lock warehouse%times%",
|
||||||
|
"IDO exchange in the first phase": "IDO exchange in the first phase",
|
||||||
|
"Opening time of next exchange period:": "Opening time of next exchange period:",
|
||||||
|
"Please enter the amount": "Please enter the amount",
|
||||||
|
"Exchange rate": "Exchange rate",
|
||||||
|
"gross": "gross",
|
||||||
|
"remaining quantity": "remaining quantity",
|
||||||
|
"Immediately change": "Immediately change",
|
||||||
|
"IDO Exchange": "IDO Exchange"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ const useAuth = () => {
|
||||||
} else {
|
} else {
|
||||||
window.localStorage.removeItem(connectorLocalStorageKey)
|
window.localStorage.removeItem(connectorLocalStorageKey)
|
||||||
if (error instanceof NoEthereumProviderError || error instanceof NoBscProviderError) {
|
if (error instanceof NoEthereumProviderError || error instanceof NoBscProviderError) {
|
||||||
toastError(t('Provider Error'), t('No provider was found'))
|
toastError(t('Provider Error'))
|
||||||
} else if (
|
} else if (
|
||||||
error instanceof UserRejectedRequestErrorInjected ||
|
error instanceof UserRejectedRequestErrorInjected ||
|
||||||
error instanceof UserRejectedRequestErrorWalletConnect
|
error instanceof UserRejectedRequestErrorWalletConnect
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import request from 'utils/request'
|
||||||
|
|
||||||
|
export const getBaseConfig = () => {
|
||||||
|
return request.request({
|
||||||
|
url: '/high_city/app/api/base/config',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getBaseConfig
|
||||||
|
|
@ -30,9 +30,15 @@ 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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export const getContract = () => {
|
||||||
|
return request.request({
|
||||||
|
url: '/high_city/app/api/contract',
|
||||||
|
method: 'get',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default getReferralRewardInfo
|
export default getReferralRewardInfo
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export const fetchBoardUserInfo = async (account: string) => {
|
||||||
stakedBalance: new BigNumber(userInfo.amount._hex).toJSON(),
|
stakedBalance: new BigNumber(userInfo.amount._hex).toJSON(),
|
||||||
unLockTime: userInfo.unLockTime ? new BigNumber(userInfo.unLockTime._hex).toNumber() : 0,
|
unLockTime: userInfo.unLockTime ? new BigNumber(userInfo.unLockTime._hex).toNumber() : 0,
|
||||||
estimatedProfit: new BigNumber(estimatedProfit).toJSON(),
|
estimatedProfit: new BigNumber(estimatedProfit).toJSON(),
|
||||||
name: board.name,
|
receiveReward: userInfo.receiveReward ? new BigNumber(userInfo.receiveReward._hex).toNumber() : 0,
|
||||||
amount: getBalanceAmount(new BigNumber(userInfo.amount?._hex)).toNumber(),
|
amount: getBalanceAmount(new BigNumber(userInfo.amount?._hex)).toNumber(),
|
||||||
rewardDebt: getBalanceAmount(new BigNumber(userInfo.rewardDebt?._hex)).toNumber(),
|
rewardDebt: getBalanceAmount(new BigNumber(userInfo.rewardDebt?._hex)).toNumber(),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,9 @@ export const fetchBoardUserDataAsync = (account) => async (dispatch) => {
|
||||||
stakedBalance: userInfo[index].stakedBalance,
|
stakedBalance: userInfo[index].stakedBalance,
|
||||||
unlockTime: userInfo[index].unLockTime,
|
unlockTime: userInfo[index].unLockTime,
|
||||||
estimatedProfit: userInfo[index].estimatedProfit,
|
estimatedProfit: userInfo[index].estimatedProfit,
|
||||||
name: userInfo[index].name,
|
|
||||||
amount: userInfo[index].amount,
|
amount: userInfo[index].amount,
|
||||||
rewardDebt: userInfo[index].rewardDebt,
|
rewardDebt: userInfo[index].rewardDebt,
|
||||||
|
receiveReward: userInfo[index].receiveReward,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
dispatch(setBoardsUserData({ arrayOfUserDataObjects }))
|
dispatch(setBoardsUserData({ arrayOfUserDataObjects }))
|
||||||
|
|
|
||||||
|
|
@ -503,6 +503,7 @@ export interface Boards extends BoardConfig {
|
||||||
stakedBalance: number
|
stakedBalance: number
|
||||||
unlockTime: number
|
unlockTime: number
|
||||||
estimatedProfit: number
|
estimatedProfit: number
|
||||||
|
receiveReward: number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export interface BoardsState {
|
export interface BoardsState {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import { Text, Flex } from '@pancakeswap/uikit'
|
import { Text, Flex } from '@pancakeswap/uikit'
|
||||||
|
|
||||||
interface InfoProps {
|
interface InfoProps {
|
||||||
title?: string
|
title?: string
|
||||||
content?: string
|
content?: string
|
||||||
publishTime?: number
|
publishTime?: string
|
||||||
top?: boolean
|
top?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -23,6 +24,24 @@ const FlexTitle = styled(Flex)`
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
${({ theme }) => theme.mediaQueries.lg} {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
const TextTitle = styled(Text)`
|
||||||
|
overflow: hidden;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: #333333;
|
||||||
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
|
max-width: 100px;
|
||||||
|
}
|
||||||
|
${({ theme }) => theme.mediaQueries.lg} {
|
||||||
|
max-width: 747px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
const TextInfo = styled(Text)`
|
const TextInfo = styled(Text)`
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
@ -33,10 +52,22 @@ const TextInfo = styled(Text)`
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
${({ theme }) => theme.mediaQueries.lg} {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
const TextTime = styled(Text)`
|
const TextTime = styled(Text)`
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
${({ theme }) => theme.mediaQueries.lg} {
|
||||||
|
font-size: 18px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
const TextTop = styled(Flex)`
|
const TextTop = styled(Flex)`
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
|
|
@ -52,17 +83,18 @@ const TextTop = styled(Flex)`
|
||||||
`
|
`
|
||||||
|
|
||||||
const ListItem: React.FC<InfoProps> = ({ title, content, publishTime, top = false }) => {
|
const ListItem: React.FC<InfoProps> = ({ title, content, publishTime, top = false }) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FlexTable>
|
<FlexTable>
|
||||||
<TableInfo>
|
<TableInfo>
|
||||||
<FlexTitle>
|
<FlexTitle>
|
||||||
{title}
|
<TextTitle>{title}</TextTitle>
|
||||||
{top ? <TextTop>置顶</TextTop> : ''}
|
{top && <TextTop>{t('top')}</TextTop>}
|
||||||
</FlexTitle>
|
</FlexTitle>
|
||||||
<TextInfo>{content}</TextInfo>
|
<TextInfo>{content}</TextInfo>
|
||||||
</TableInfo>
|
</TableInfo>
|
||||||
<TextTime color="textSubtle">{publishTime}</TextTime>
|
<TextTime color="textSubtle">{publishTime?.split(' ')[0]}</TextTime>
|
||||||
</FlexTable>
|
</FlexTable>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ interface DetailProps {
|
||||||
}
|
}
|
||||||
const ContainerMain = styled.div`
|
const ContainerMain = styled.div`
|
||||||
background: ${({ theme }) => theme.colors.gradients.bubblegum};
|
background: ${({ theme }) => theme.colors.gradients.bubblegum};
|
||||||
padding: 30px 0;
|
|
||||||
`
|
`
|
||||||
const MainDiv = styled.div`
|
const MainDiv = styled.div`
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
import BigNumber from 'bignumber.js'
|
||||||
|
import React, { useCallback, useMemo, useState } from 'react'
|
||||||
|
import { Button, Modal, Text } from '@pancakeswap/uikit'
|
||||||
|
import { ModalActions, ModalInput } from 'components/Modal'
|
||||||
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
import useToast from 'hooks/useToast'
|
||||||
|
import { getFullDisplayBalance } from 'utils/formatBalance'
|
||||||
|
|
||||||
|
interface AffirmModalProps {
|
||||||
|
title?: string
|
||||||
|
content?: string
|
||||||
|
onDismiss?: () => void
|
||||||
|
handSubmit?: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const DepositModal: React.FC<AffirmModalProps> = ({ title, content, onDismiss, handSubmit }) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
const submit = async () => {
|
||||||
|
await handSubmit()
|
||||||
|
onDismiss()
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Modal title={t(`${title}`)} onDismiss={onDismiss}>
|
||||||
|
<Text>{!content ? t('Whether to cancel') : content}</Text>
|
||||||
|
<ModalActions>
|
||||||
|
<Button variant="secondary" onClick={onDismiss} width="100%">
|
||||||
|
{t('Cancel')}
|
||||||
|
</Button>
|
||||||
|
<Button width="100%" onClick={submit}>
|
||||||
|
{t('Confirm')}
|
||||||
|
</Button>
|
||||||
|
</ModalActions>
|
||||||
|
</Modal>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default DepositModal
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import React, { useMemo, useState } from 'react'
|
import React, { useMemo, useState, useEffect } from 'react'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import styled, { keyframes } from 'styled-components'
|
import styled, { keyframes } from 'styled-components'
|
||||||
import { Flex, Text, Skeleton } from '@pancakeswap/uikit'
|
import { Flex, Text, Skeleton } from '@pancakeswap/uikit'
|
||||||
|
|
@ -58,8 +59,8 @@ const FCard = styled.div`
|
||||||
box-shadow: 0px 2px 30px 0px rgba(0, 0, 0, 0.1);
|
box-shadow: 0px 2px 30px 0px rgba(0, 0, 0, 0.1);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-around;
|
/* justify-content: space-around; */
|
||||||
padding: 24px;
|
/* padding: 24px; */
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
min-height: 410px;
|
min-height: 410px;
|
||||||
|
|
@ -77,32 +78,75 @@ const ExpandingWrapper = styled.div<{ expanded: boolean }>`
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const CardDiv = styled.div`
|
||||||
|
min-height: calc(410px - 90px);
|
||||||
|
padding: 0 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-around;
|
||||||
|
`
|
||||||
|
const ContentDiv = styled.div`
|
||||||
|
padding: 0 20px;
|
||||||
|
`
|
||||||
|
const InfoDiv = styled(Flex)`
|
||||||
|
flex-direction: column;
|
||||||
|
height: 60px;
|
||||||
|
justify-content: space-between;
|
||||||
|
`
|
||||||
|
|
||||||
interface NodeCardProps {
|
interface NodeCardProps {
|
||||||
board: any
|
board: any
|
||||||
removed: boolean
|
removed: boolean
|
||||||
provider?: ProviderType
|
provider?: ProviderType
|
||||||
account?: string
|
account?: string
|
||||||
|
boardsData?: any
|
||||||
}
|
}
|
||||||
|
|
||||||
const BoardCard: React.FC<NodeCardProps> = ({ board, account }) => {
|
const BoardCard: React.FC<NodeCardProps> = ({ board, account, boardsData }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
const [countDown, setCountDown] = useState('')
|
||||||
|
useEffect(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
if (board.userData?.unlockTime) {
|
||||||
|
const time = board.userData?.unlockTime * 1000
|
||||||
|
countDownFun(time - 1)
|
||||||
|
}
|
||||||
|
}, 1000)
|
||||||
|
}, [countDown, board])
|
||||||
|
|
||||||
|
const countDownFun = (date) => {
|
||||||
|
const date1 = dayjs()
|
||||||
|
const date2 = dayjs(date)
|
||||||
|
const time = date2.diff(date1)
|
||||||
|
if (time > 0) {
|
||||||
|
const hour = Math.floor((time / (1000 * 60 * 60)) % 24)
|
||||||
|
const minute = Math.floor((time / (1000 * 60)) % 60)
|
||||||
|
const second = Math.round((time / 1000) % 60)
|
||||||
|
setCountDown(`${hour}:${minute}:${second}`)
|
||||||
|
} else {
|
||||||
|
setCountDown(`${t('End of the lock up')}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const [showExpandableSection, setShowExpandableSection] = useState(false)
|
const [showExpandableSection, setShowExpandableSection] = useState(false)
|
||||||
return (
|
return (
|
||||||
<FCard>
|
<FCard>
|
||||||
<CardHeading name={t(board.name)} img={board.img} tokenSymbol={board.tokenSymbol} />
|
<CardHeading
|
||||||
|
name={t(board.name)}
|
||||||
|
img={board.img}
|
||||||
|
tokenSymbol={board.tokenSymbol}
|
||||||
|
amount={board.userData?.amount}
|
||||||
|
/>
|
||||||
|
<ContentDiv>
|
||||||
{account && (
|
{account && (
|
||||||
<div>
|
<InfoDiv>
|
||||||
<FlexText name={t('HCC Currency amount')} value={board.userData?.amount} />
|
<FlexText name={t('HCC Currency amount')} value={board.userData?.amount as number} />
|
||||||
{board.userData?.name === 'Board' ? (
|
{board.pid === 1 && board.userData?.amount ? <FlexText name={t('Lock up time')} value={countDown} /> : ''}
|
||||||
<FlexText name={t('Lock up time')} value={board.userData?.unlockTime} />
|
<FlexText name={t('possess LP')} value={board.userData?.amount / boardsData?.curAmount || 0} />
|
||||||
) : (
|
</InfoDiv>
|
||||||
''
|
|
||||||
)}
|
|
||||||
<FlexText name={t('possess LP')} value={board.userData?.rewardDebt} />
|
|
||||||
</div>
|
|
||||||
)}
|
)}
|
||||||
<CardActionsContainer board={board} account={account} />
|
<CardActionsContainer board={board} account={account} />
|
||||||
|
</ContentDiv>
|
||||||
{/* <Divider />
|
{/* <Divider />
|
||||||
<ExpandableSectionButton
|
<ExpandableSectionButton
|
||||||
onClick={() => setShowExpandableSection(!showExpandableSection)}
|
onClick={() => setShowExpandableSection(!showExpandableSection)}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useState, useCallback } from 'react'
|
import React, { useState, useCallback, useMemo } from 'react'
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import { provider as ProviderType } from 'web3-core'
|
import { provider as ProviderType } from 'web3-core'
|
||||||
|
|
@ -6,17 +6,28 @@ import { getAddress } from 'utils/addressHelpers'
|
||||||
import { Button, Flex, Text } from '@pancakeswap/uikit'
|
import { Button, Flex, Text } from '@pancakeswap/uikit'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import { Boards } from 'state/types'
|
import { Boards } from 'state/types'
|
||||||
import { useBoardUser } from 'state/hooks'
|
import { useBoardUser, usePriceCakeBusd, usePriceHccUsdt } from 'state/hooks'
|
||||||
import { TOKEN_SYMBOL } from 'config/index'
|
import { TOKEN_SYMBOL } from 'config/index'
|
||||||
import { getBalanceNumber } from 'utils/formatBalance'
|
|
||||||
|
import { useWeb3React } from '@web3-react/core'
|
||||||
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
|
import { BIG_ZERO } from 'utils/bigNumber'
|
||||||
|
|
||||||
|
import { getBalanceNumber, getBalanceAmount } from 'utils/formatBalance'
|
||||||
import { useERC20 } from 'hooks/useContract'
|
import { useERC20 } from 'hooks/useContract'
|
||||||
import UnlockButton from 'components/UnlockButton'
|
import UnlockButton from 'components/UnlockButton'
|
||||||
import useApproveBoard from '../../hooks/useApproveBoard'
|
import useApproveBoard from '../../hooks/useApproveBoard'
|
||||||
import StakeAction from './StakeAction'
|
import StakeAction from './StakeAction'
|
||||||
import HarvestAction from './HarvestAction'
|
import HarvestAction from './HarvestAction'
|
||||||
|
|
||||||
|
import useHarvestBoard from '../../hooks/useHarvestBoard'
|
||||||
|
import FlexText from './FlexText'
|
||||||
|
|
||||||
const Action = styled.div`
|
const Action = styled.div`
|
||||||
padding-top: 16px;
|
padding-top: 4px;
|
||||||
|
`
|
||||||
|
const PriceCoin = styled.div`
|
||||||
|
text-align: right;
|
||||||
`
|
`
|
||||||
|
|
||||||
interface NodeCardActionsProps {
|
interface NodeCardActionsProps {
|
||||||
|
|
@ -35,6 +46,10 @@ const CardActions: React.FC<NodeCardActionsProps> = ({ board, account }) => {
|
||||||
|
|
||||||
const { onApprove } = useApproveBoard(tokenContract, pid)
|
const { onApprove } = useApproveBoard(tokenContract, pid)
|
||||||
|
|
||||||
|
const rawEarningsBalance = account ? getBalanceAmount(new BigNumber(estimatedProfit)).toNumber() : BIG_ZERO
|
||||||
|
const displayBalance = rawEarningsBalance.toFixed(3, BigNumber.ROUND_DOWN)
|
||||||
|
const hccPriceUsdt = usePriceHccUsdt()
|
||||||
|
|
||||||
const handleApprove = useCallback(async () => {
|
const handleApprove = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
setRequestedApproval(true)
|
setRequestedApproval(true)
|
||||||
|
|
@ -44,29 +59,48 @@ const CardActions: React.FC<NodeCardActionsProps> = ({ board, account }) => {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
}, [onApprove])
|
}, [onApprove])
|
||||||
|
// const [totalPrice, setTotalPrice] = useState(0)
|
||||||
|
const totalPrice = useMemo(() => {
|
||||||
|
return getBalanceAmount(new BigNumber(board?.userData?.receiveReward)).toNumber() + Number(displayBalance)
|
||||||
|
}, [board])
|
||||||
const renderApprovalOrStakeButton = () => {
|
const renderApprovalOrStakeButton = () => {
|
||||||
return isApproved ? (
|
return isApproved ? (
|
||||||
<>
|
<>
|
||||||
<Flex>
|
<FlexText name={t('The total amount of dividends')} value={totalPrice.toFixed(3)} />
|
||||||
|
<Flex justifyContent="space-between" alignItems="center">
|
||||||
|
<Text fontSize="12px" color="#1FC7D4">
|
||||||
|
{t('Unclaimed income')}
|
||||||
|
</Text>
|
||||||
|
<PriceCoin>
|
||||||
|
<Text fontSize="16px" color="#1FC7D4">
|
||||||
|
{displayBalance}
|
||||||
|
</Text>
|
||||||
|
<Text fontSize="12px" color="#9BE5EB">
|
||||||
|
{(Number(hccPriceUsdt.toNumber().toFixed(3)) * Number(displayBalance)).toFixed(3)} USDT
|
||||||
|
</Text>
|
||||||
|
</PriceCoin>
|
||||||
|
</Flex>
|
||||||
|
{/* <FlexText name={t('Unclaimed income')} value={displayBalance} /> */}
|
||||||
|
{/* <Flex>
|
||||||
<Text bold textTransform="uppercase" color="secondary" fontSize="12px" pr="3px">
|
<Text bold textTransform="uppercase" color="secondary" fontSize="12px" pr="3px">
|
||||||
{board.tokenSymbol}
|
{board.tokenSymbol}
|
||||||
</Text>
|
</Text>
|
||||||
<Text bold textTransform="uppercase" color="textSubtle" fontSize="12px">
|
<Text bold textTransform="uppercase" color="textSubtle" fontSize="12px">
|
||||||
{t('Staked')}
|
{t('Staked')}
|
||||||
</Text>
|
</Text>
|
||||||
</Flex>
|
</Flex> */}
|
||||||
<StakeAction stakedBalance={stakedBalance} tokenBalance={tokenBalance} pid={pid} />
|
<HarvestAction earnings={new BigNumber(estimatedProfit)} pid={pid} board={board} />
|
||||||
<Flex flexDirection="column" alignItems="flex-start" mt="10">
|
<StakeAction stakedBalance={stakedBalance} tokenBalance={tokenBalance} pid={pid} board={board} />
|
||||||
<Text color="textSubtle" fontSize="12px">
|
{/* <Flex flexDirection="column" alignItems="flex-start" mt="10"> */}
|
||||||
|
{/* <Text color="textSubtle" fontSize="12px">
|
||||||
{t('Unclaimed income')}
|
{t('Unclaimed income')}
|
||||||
</Text>
|
</Text> */}
|
||||||
<HarvestAction earnings={new BigNumber(estimatedProfit)} pid={pid} />
|
{/* <HarvestAction earnings={new BigNumber(estimatedProfit)} pid={pid} /> */}
|
||||||
</Flex>
|
{/* </Flex> */}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Button mt="8px" width="100%" disabled={requestedApproval} onClick={handleApprove}>
|
<Button mt="8px" width="100%" disabled={requestedApproval} onClick={handleApprove}>
|
||||||
{t('Approve Contract')}
|
{t('license agreement')}
|
||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import { Tag, Flex, Heading, Image } from '@pancakeswap/uikit'
|
import { Tag, Flex, Heading, Image } from '@pancakeswap/uikit'
|
||||||
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
import Question from 'components/QuestionHelper'
|
import Question from 'components/QuestionHelper'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
|
||||||
|
|
@ -9,23 +10,81 @@ export interface ExpandableSectionProps {
|
||||||
isCommunityFarm?: boolean
|
isCommunityFarm?: boolean
|
||||||
img?: string
|
img?: string
|
||||||
tokenSymbol?: string
|
tokenSymbol?: string
|
||||||
|
amount?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
const Wrapper = styled(Flex)`
|
const Wrapper = styled(Flex)`
|
||||||
|
height: 90px;
|
||||||
|
background: linear-gradient(90deg, #f1ecf2 0%, #e9f1f5 100%);
|
||||||
|
font-size: 30px;
|
||||||
|
color: #280d5f;
|
||||||
|
padding-left: 20px;
|
||||||
|
border-radius: 32px 32px 0 0;
|
||||||
|
position: relative;
|
||||||
svg {
|
svg {
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
}
|
}
|
||||||
`
|
.corner-mark {
|
||||||
|
width: 88px;
|
||||||
|
height: 89px;
|
||||||
|
overflow: hidden;
|
||||||
|
position: absolute;
|
||||||
|
top: 0px;
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
const CardHeading: React.FC<ExpandableSectionProps> = ({ name, img, tokenSymbol }) => {
|
.ribbon {
|
||||||
|
line-height: 12px;
|
||||||
|
text-align: center;
|
||||||
|
transform: rotate(50deg);
|
||||||
|
position: relative;
|
||||||
|
padding: 8px 0;
|
||||||
|
right: 15px;
|
||||||
|
top: 20px;
|
||||||
|
width: 150px;
|
||||||
|
background: linear-gradient(180deg, #b43ff9 0%, #7a44db 100%);
|
||||||
|
color: white;
|
||||||
|
box-shadow: 0 5px 5px rgba(0, 0, 0, 0.1);
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ribbon1:before,
|
||||||
|
.ribbon1:after {
|
||||||
|
content: '';
|
||||||
|
border-top: 3px solid #4e7c7d;
|
||||||
|
border-left: 3px solid transparent;
|
||||||
|
border-right: 3px solid transparent;
|
||||||
|
position: absolute;
|
||||||
|
bottom: -4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ribbon1:before {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ribbon1:after {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
const HeaderFlex = styled(Flex)``
|
||||||
|
|
||||||
|
const CardHeading: React.FC<ExpandableSectionProps> = ({ name, img, tokenSymbol, amount }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
const account = useAccount()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper justifyContent="space-between" alignItems="center" mb="12px">
|
<Wrapper justifyContent="space-between" alignItems="center" mb="12px">
|
||||||
<Image src={`/images/nodes/${img}.png`} width={64} height={64} />
|
{/* <Image src={`/images/nodes/${img}.png`} width={64} height={64} /> */}
|
||||||
<Flex>
|
<HeaderFlex>
|
||||||
<Heading mb="4px">{name}</Heading>
|
<Heading mb="4px">{t(`${name}`)}</Heading>
|
||||||
{/* <Question text={t('To join board, you need to stake at least 0.1% total supply of Token')} /> */}
|
{/* <Question text={t('To join board, you need to stake at least 0.1% total supply of Token')} /> */}
|
||||||
</Flex>
|
</HeaderFlex>
|
||||||
|
{amount > 0 && account && (
|
||||||
|
<div className="corner-mark">
|
||||||
|
<div className="ribbon">{t('Staked')}</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import BigNumber from 'bignumber.js'
|
||||||
import { Button, Flex, Heading } from '@pancakeswap/uikit'
|
import { Button, Flex, Heading } from '@pancakeswap/uikit'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import { useAppDispatch } from 'state'
|
import { useAppDispatch } from 'state'
|
||||||
|
import { Boards } from 'state/types'
|
||||||
import { fetchFarmUserDataAsync } from 'state/farms'
|
import { fetchFarmUserDataAsync } from 'state/farms'
|
||||||
import useToast from 'hooks/useToast'
|
import useToast from 'hooks/useToast'
|
||||||
import { getBalanceAmount } from 'utils/formatBalance'
|
import { getBalanceAmount } from 'utils/formatBalance'
|
||||||
|
|
@ -16,9 +17,10 @@ import useHarvestBoard from '../../hooks/useHarvestBoard'
|
||||||
interface FarmCardActionsProps {
|
interface FarmCardActionsProps {
|
||||||
earnings?: BigNumber
|
earnings?: BigNumber
|
||||||
pid?: number
|
pid?: number
|
||||||
|
board?: Boards
|
||||||
}
|
}
|
||||||
|
|
||||||
const HarvestAction: React.FC<FarmCardActionsProps> = ({ earnings, pid }) => {
|
const HarvestAction: React.FC<FarmCardActionsProps> = ({ earnings, pid, board }) => {
|
||||||
const { account } = useWeb3React()
|
const { account } = useWeb3React()
|
||||||
const { toastSuccess, toastError } = useToast()
|
const { toastSuccess, toastError } = useToast()
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
@ -29,17 +31,19 @@ const HarvestAction: React.FC<FarmCardActionsProps> = ({ earnings, pid }) => {
|
||||||
const rawEarningsBalance = account ? getBalanceAmount(earnings) : BIG_ZERO
|
const rawEarningsBalance = account ? getBalanceAmount(earnings) : BIG_ZERO
|
||||||
const displayBalance = rawEarningsBalance.toFixed(3, BigNumber.ROUND_DOWN)
|
const displayBalance = rawEarningsBalance.toFixed(3, BigNumber.ROUND_DOWN)
|
||||||
const earningsBusd = rawEarningsBalance ? rawEarningsBalance.multipliedBy(cakePrice).toNumber() : 0
|
const earningsBusd = rawEarningsBalance ? rawEarningsBalance.multipliedBy(cakePrice).toNumber() : 0
|
||||||
|
const unlockTime = board.userData.unlockTime * 1000
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex width="100%" justifyContent="space-between" alignItems="center">
|
<Flex width="100%" marginTop={25} justifyContent="space-between" alignItems="center">
|
||||||
<Flex flexDirection="column" alignItems="flex-start">
|
{/* <Flex flexDirection="column" alignItems="flex-start">
|
||||||
<Heading color={rawEarningsBalance.eq(0) ? 'textDisabled' : 'text'}>{displayBalance}</Heading>
|
<Heading color={rawEarningsBalance.eq(0) ? 'textDisabled' : 'text'}>{displayBalance}</Heading>
|
||||||
{earningsBusd > 0 && (
|
{earningsBusd > 0 && (
|
||||||
<Balance fontSize="12px" color="textSubtle" decimals={2} value={earningsBusd} unit=" USD" prefix="~" />
|
<Balance fontSize="12px" color="textSubtle" decimals={2} value={earningsBusd} unit=" USD" prefix="~" />
|
||||||
)}
|
)}
|
||||||
</Flex>
|
</Flex> */}
|
||||||
<Button
|
<Button
|
||||||
disabled={rawEarningsBalance.eq(0) || pendingTx}
|
width="100%"
|
||||||
|
disabled={rawEarningsBalance.eq(0) || pendingTx || (unlockTime > new Date().getTime() && board.pid === 1)}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
setPendingTx(true)
|
setPendingTx(true)
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
import React, { useMemo } from 'react'
|
import React, { useMemo, useEffect, useState } from 'react'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import { Button, Flex, Heading, IconButton, AddIcon, MinusIcon, useModal } from '@pancakeswap/uikit'
|
import { Button, Flex, Heading, IconButton, AddIcon, MinusIcon, useModal } from '@pancakeswap/uikit'
|
||||||
import { getBalanceNumber } from 'utils/formatBalance'
|
import { getBalanceNumber } from 'utils/formatBalance'
|
||||||
|
import { Boards } from 'state/types'
|
||||||
import { useBoardsFromPid } from 'state/hooks'
|
import { useBoardsFromPid } from 'state/hooks'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
import { getBaseConfig } from 'services/board'
|
||||||
import useToast from 'hooks/useToast'
|
import useToast from 'hooks/useToast'
|
||||||
import DepositModal from '../DepositModal'
|
import DepositModal from '../DepositModal'
|
||||||
|
import AffirmModal from '../AffirmModal'
|
||||||
|
|
||||||
import useStakeBoard from '../../hooks/useStakeBoard'
|
import useStakeBoard from '../../hooks/useStakeBoard'
|
||||||
import useUnstakeBoard, { useUnstakeForceBoard } from '../../hooks/useUnstakeBoard'
|
import useUnstakeBoard, { useUnstakeForceBoard } from '../../hooks/useUnstakeBoard'
|
||||||
import WithdrawModal from '../WithdrawModal'
|
import WithdrawModal from '../WithdrawModal'
|
||||||
|
|
@ -17,16 +21,21 @@ interface NodeCardActionsProps {
|
||||||
tokenBalance?: BigNumber
|
tokenBalance?: BigNumber
|
||||||
tokenName?: string
|
tokenName?: string
|
||||||
pid?: number
|
pid?: number
|
||||||
|
board?: Boards
|
||||||
}
|
}
|
||||||
|
|
||||||
const IconButtonWrapper = styled.div`
|
const IconButtonWrapper = styled.div`
|
||||||
display: flex;
|
width: 100%;
|
||||||
svg {
|
svg {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
const IconButtonDiv = styled(IconButton)`
|
||||||
|
width: 100%;
|
||||||
|
padding: 0 10px;
|
||||||
|
`
|
||||||
|
|
||||||
const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalance, tokenName, pid }) => {
|
const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalance, tokenName, pid, board }) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { toastWarning } = useToast()
|
const { toastWarning } = useToast()
|
||||||
const { onStake } = useStakeBoard(pid)
|
const { onStake } = useStakeBoard(pid)
|
||||||
|
|
@ -38,8 +47,42 @@ const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalan
|
||||||
const minAmount = minStakeAmount - getBalanceNumber(userData.stakedBalance, tokenDecimals)
|
const minAmount = minStakeAmount - getBalanceNumber(userData.stakedBalance, tokenDecimals)
|
||||||
return minAmount < 0 ? new BigNumber(0) : new BigNumber(minAmount)
|
return minAmount < 0 ? new BigNumber(0) : new BigNumber(minAmount)
|
||||||
}, [userData, minStakeAmount, tokenDecimals])
|
}, [userData, minStakeAmount, tokenDecimals])
|
||||||
|
const [unlockTimeTxt, setUnlockTimeTxt] = useState('')
|
||||||
|
|
||||||
|
const getLockUpTime = async () => {
|
||||||
|
const times = await getBaseConfig()
|
||||||
|
formatSeconds(Number(times))
|
||||||
|
}
|
||||||
|
|
||||||
|
const formatSeconds = (value: number) => {
|
||||||
|
const second = value
|
||||||
|
// 分
|
||||||
|
let minute = 0
|
||||||
|
// 如果秒数大于60,将秒数转换成整数
|
||||||
|
if (second > 60) {
|
||||||
|
// 获取分钟,除以60取整数,得到整数分钟
|
||||||
|
minute = second / 60
|
||||||
|
// 获取秒数,秒数取佘,得到整数秒数
|
||||||
|
const ss = second % 60
|
||||||
|
// 如果分钟大于60,将分钟转换成小时
|
||||||
|
if (minute > 60) {
|
||||||
|
// 获取小时,获取分钟除以60,得到整数小时
|
||||||
|
const hh = minute / 60
|
||||||
|
// 获取小时后取佘的分,获取分钟除以60取佘的分
|
||||||
|
const mm = minute % 60
|
||||||
|
setUnlockTimeTxt(`${parseInt(hh.toString())}:${parseInt(mm.toString())}:${parseInt(ss.toString())}`)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setUnlockTimeTxt(second.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getLockUpTime()
|
||||||
|
}, [])
|
||||||
const [onPresentDeposit] = useModal(
|
const [onPresentDeposit] = useModal(
|
||||||
<DepositModal
|
<DepositModal
|
||||||
|
board={board}
|
||||||
|
time={unlockTimeTxt}
|
||||||
max={tokenBalance}
|
max={tokenBalance}
|
||||||
tokenDecimals={tokenDecimals}
|
tokenDecimals={tokenDecimals}
|
||||||
min={minStakedAmount}
|
min={minStakedAmount}
|
||||||
|
|
@ -47,9 +90,11 @@ const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalan
|
||||||
tokenName={tokenName}
|
tokenName={tokenName}
|
||||||
/>,
|
/>,
|
||||||
)
|
)
|
||||||
|
|
||||||
const [onPresentWithdraw] = useModal(
|
const [onPresentWithdraw] = useModal(
|
||||||
<WithdrawModal max={stakedBalance} tokenDecimals={tokenDecimals} onConfirm={onUnstake} tokenName={tokenName} />,
|
<WithdrawModal max={stakedBalance} tokenDecimals={tokenDecimals} onConfirm={onUnstake} tokenName={tokenName} />,
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleUnstake = () => {
|
const handleUnstake = () => {
|
||||||
const unlockTime = userData.unlockTime * 1000
|
const unlockTime = userData.unlockTime * 1000
|
||||||
if (unlockTime > new Date().getTime()) {
|
if (unlockTime > new Date().getTime()) {
|
||||||
|
|
@ -58,15 +103,42 @@ const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalan
|
||||||
onUnstake()
|
onUnstake()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const [onPresentAffirm] = useModal(
|
||||||
|
<AffirmModal
|
||||||
|
title={
|
||||||
|
board.pid === 1
|
||||||
|
? board.userData?.unlockTime * 1000 <= new Date().getTime()
|
||||||
|
? t('Cancel the pledge')
|
||||||
|
: t('Forced to cancel')
|
||||||
|
: t('Cancel the pledge')
|
||||||
|
}
|
||||||
|
content={
|
||||||
|
board.pid === 1
|
||||||
|
? board.userData?.unlockTime * 1000 <= new Date().getTime()
|
||||||
|
? t('Cancel the pledge')
|
||||||
|
: t('Earnings will be cleared after forced cancellation. Confirm cancellation')
|
||||||
|
: t('Cancel the pledge')
|
||||||
|
}
|
||||||
|
handSubmit={handleUnstake}
|
||||||
|
/>,
|
||||||
|
)
|
||||||
const renderStakingButtons = () => {
|
const renderStakingButtons = () => {
|
||||||
return rawStakedBalance === 0 ? (
|
return rawStakedBalance === 0 ? (
|
||||||
<Button onClick={onPresentDeposit}>{t(`pledge`)}</Button>
|
<Button width="100%" onClick={onPresentDeposit}>
|
||||||
|
{t(`pledge`)}
|
||||||
|
</Button>
|
||||||
) : (
|
) : (
|
||||||
<IconButtonWrapper>
|
<IconButtonWrapper>
|
||||||
{userData.stakedBalance > 0 ? (
|
{userData.stakedBalance > 0 ? (
|
||||||
<IconButton variant="tertiary" onClick={handleUnstake}>
|
// <IconButtonDiv variant="tertiary" onClick={handleUnstake}>
|
||||||
<MinusIcon color="primary" />
|
<IconButtonDiv variant="tertiary" onClick={onPresentAffirm}>
|
||||||
</IconButton>
|
{board.pid === 1
|
||||||
|
? board.userData?.unlockTime * 1000 <= new Date().getTime()
|
||||||
|
? t('Cancel the pledge')
|
||||||
|
: t('Forced to cancel')
|
||||||
|
: t('Cancel the pledge')}
|
||||||
|
</IconButtonDiv>
|
||||||
) : (
|
) : (
|
||||||
<IconButton variant="tertiary" onClick={onPresentDeposit} ml="6px">
|
<IconButton variant="tertiary" onClick={onPresentDeposit} ml="6px">
|
||||||
<AddIcon color="primary" />
|
<AddIcon color="primary" />
|
||||||
|
|
@ -77,8 +149,8 @@ const StakeAction: React.FC<NodeCardActionsProps> = ({ stakedBalance, tokenBalan
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex justifyContent="space-between" alignItems="center">
|
<Flex justifyContent="space-between" alignItems="center" marginTop="20px">
|
||||||
<Heading color={rawStakedBalance === 0 ? 'textDisabled' : 'text'}>{rawStakedBalance}</Heading>
|
{/* <Heading color={rawStakedBalance === 0 ? 'textDisabled' : 'text'}>{rawStakedBalance}</Heading> */}
|
||||||
{renderStakingButtons()}
|
{renderStakingButtons()}
|
||||||
</Flex>
|
</Flex>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
import BigNumber from 'bignumber.js'
|
import BigNumber from 'bignumber.js'
|
||||||
import React, { useCallback, useMemo, useState } from 'react'
|
import React, { useCallback, useMemo, useState } from 'react'
|
||||||
import { Button, Modal, LinkExternal } from '@pancakeswap/uikit'
|
import { Button, Modal, LinkExternal, Text } from '@pancakeswap/uikit'
|
||||||
import { ModalActions, ModalInput } from 'components/Modal'
|
import { ModalActions, ModalInput } from 'components/Modal'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import useToast from 'hooks/useToast'
|
import useToast from 'hooks/useToast'
|
||||||
import { getFullDisplayBalance } from 'utils/formatBalance'
|
import { getFullDisplayBalance } from 'utils/formatBalance'
|
||||||
|
import { Boards } from 'state/types'
|
||||||
|
|
||||||
interface DepositModalProps {
|
interface DepositModalProps {
|
||||||
min: BigNumber
|
min: BigNumber
|
||||||
|
|
@ -14,6 +15,8 @@ interface DepositModalProps {
|
||||||
tokenName?: string
|
tokenName?: string
|
||||||
tokenDecimals?: number
|
tokenDecimals?: number
|
||||||
addLiquidityUrl?: string
|
addLiquidityUrl?: string
|
||||||
|
time?: string
|
||||||
|
board?: Boards
|
||||||
}
|
}
|
||||||
|
|
||||||
const DepositModal: React.FC<DepositModalProps> = ({
|
const DepositModal: React.FC<DepositModalProps> = ({
|
||||||
|
|
@ -24,7 +27,10 @@ const DepositModal: React.FC<DepositModalProps> = ({
|
||||||
tokenDecimals = 18,
|
tokenDecimals = 18,
|
||||||
tokenName = '',
|
tokenName = '',
|
||||||
addLiquidityUrl,
|
addLiquidityUrl,
|
||||||
|
time,
|
||||||
|
board,
|
||||||
}) => {
|
}) => {
|
||||||
|
const regNumber = /^\d+(\.\d+)?$/
|
||||||
const { toastSuccess, toastError, toastWarning } = useToast()
|
const { toastSuccess, toastError, toastWarning } = useToast()
|
||||||
const [val, setVal] = useState('')
|
const [val, setVal] = useState('')
|
||||||
const [pendingTx, setPendingTx] = useState(false)
|
const [pendingTx, setPendingTx] = useState(false)
|
||||||
|
|
@ -43,9 +49,11 @@ const DepositModal: React.FC<DepositModalProps> = ({
|
||||||
const handleSelectMax = useCallback(() => {
|
const handleSelectMax = useCallback(() => {
|
||||||
setVal(fullBalance)
|
setVal(fullBalance)
|
||||||
}, [fullBalance, setVal])
|
}, [fullBalance, setVal])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal title={t('pledge')} onDismiss={onDismiss}>
|
<Modal title={t('pledge')} onDismiss={onDismiss}>
|
||||||
|
{time && board?.pid === 1 && (
|
||||||
|
<Text marginBottom={20}>{t('After pledge, income will lock warehouse%times%', { times: time })}</Text>
|
||||||
|
)}
|
||||||
<ModalInput
|
<ModalInput
|
||||||
value={val}
|
value={val}
|
||||||
onSelectMax={handleSelectMax}
|
onSelectMax={handleSelectMax}
|
||||||
|
|
@ -63,14 +71,22 @@ const DepositModal: React.FC<DepositModalProps> = ({
|
||||||
width="100%"
|
width="100%"
|
||||||
disabled={pendingTx || fullBalance === '0' || val === '0'}
|
disabled={pendingTx || fullBalance === '0' || val === '0'}
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
|
if (!regNumber.test(val)) {
|
||||||
|
toastWarning(t('Please enter a number'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (Number(val) > Number(fullBalance)) {
|
||||||
|
toastWarning(t('Insufficient Balance'))
|
||||||
|
return
|
||||||
|
}
|
||||||
if (Number(val) < min.toNumber()) {
|
if (Number(val) < min.toNumber()) {
|
||||||
toastWarning(t('Hint'), `${t('At least stake ')}${min.toNumber()}`)
|
toastWarning(`${t('Minimum amount pledged')}${min.toNumber()}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setPendingTx(true)
|
setPendingTx(true)
|
||||||
try {
|
try {
|
||||||
await onConfirm(val)
|
await onConfirm(val)
|
||||||
toastSuccess(t('Staked!'), t('Your funds have been staked in the farm'))
|
toastSuccess(t('Staked!'))
|
||||||
onDismiss()
|
onDismiss()
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
toastError(
|
toastError(
|
||||||
|
|
@ -86,9 +102,9 @@ const DepositModal: React.FC<DepositModalProps> = ({
|
||||||
{pendingTx ? t('Pending Confirmation') : t('Confirm')}
|
{pendingTx ? t('Pending Confirmation') : t('Confirm')}
|
||||||
</Button>
|
</Button>
|
||||||
</ModalActions>
|
</ModalActions>
|
||||||
<LinkExternal href={addLiquidityUrl} style={{ alignSelf: 'center' }}>
|
{/* <LinkExternal href={addLiquidityUrl} style={{ alignSelf: 'center' }}>
|
||||||
{t('Get %symbol%', { symbol: tokenName })}
|
{t('Get %symbol%', { symbol: tokenName })}
|
||||||
</LinkExternal>
|
</LinkExternal> */}
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,12 @@ import { useTranslation } from 'contexts/Localization'
|
||||||
import BoardCard from './components/BoardCard/BoardCard'
|
import BoardCard from './components/BoardCard/BoardCard'
|
||||||
import HeaderItem from './components/HeaderItem'
|
import HeaderItem from './components/HeaderItem'
|
||||||
|
|
||||||
|
const PageContent = styled.div`
|
||||||
|
background-image: url('/images/recommend/bg.svg');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: cover;
|
||||||
|
`
|
||||||
|
|
||||||
const Header = styled.div`
|
const Header = styled.div`
|
||||||
padding: 32px 0px;
|
padding: 32px 0px;
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
|
|
@ -55,6 +61,8 @@ const Boards: React.FC = () => {
|
||||||
const [boardNum, setBoardNum] = useState(0)
|
const [boardNum, setBoardNum] = useState(0)
|
||||||
const [holderNum, setHolder] = useState(0)
|
const [holderNum, setHolder] = useState(0)
|
||||||
|
|
||||||
|
const [boardsDataList, setBoardsDataList] = useState([])
|
||||||
|
|
||||||
// 获取分红总额
|
// 获取分红总额
|
||||||
const fetchBoardShares = async () => {
|
const fetchBoardShares = async () => {
|
||||||
const boardsData = await Promise.all(
|
const boardsData = await Promise.all(
|
||||||
|
|
@ -74,25 +82,28 @@ const Boards: React.FC = () => {
|
||||||
])
|
])
|
||||||
return {
|
return {
|
||||||
pid: boardConfig.pid,
|
pid: boardConfig.pid,
|
||||||
totalAmount: getBalanceAmount(new BigNumber(boardPoolInfo.totalAmount._hex)).toNumber(),
|
curAmount: getBalanceAmount(new BigNumber(boardPoolInfo.curAmount._hex)).toNumber(),
|
||||||
num: new BigNumber(boardPoolInfo?.num?._hex).toNumber(),
|
holderNum: new BigNumber(boardPoolInfo?.holderNum?._hex).toNumber(),
|
||||||
waitWithdrawAmount: getBalanceAmount(new BigNumber(waitWithdrawAmount.balance._hex)).toNumber(),
|
waitWithdrawAmount: getBalanceAmount(new BigNumber(waitWithdrawAmount.balance._hex)).toNumber(),
|
||||||
|
totalReward: getBalanceAmount(new BigNumber(boardPoolInfo?.totalReward?._hex)).toNumber(),
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
let total = 0
|
let total = 0
|
||||||
let waitWithdrawAmountValue = 0
|
let totalReward = 0
|
||||||
boardsData.forEach((item) => {
|
boardsData.forEach((item) => {
|
||||||
total += item.totalAmount
|
total += item.curAmount
|
||||||
waitWithdrawAmountValue += item.waitWithdrawAmount
|
totalReward += item.totalReward
|
||||||
if (item.pid === 1) {
|
if (item.pid === 1) {
|
||||||
setBoardNum(item.num)
|
setBoardNum(item.holderNum)
|
||||||
} else if (item.pid === 2) {
|
} else if (item.pid === 2) {
|
||||||
setHolder(item.waitWithdrawAmount)
|
setHolder(item.holderNum)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
setBoardsDataList(boardsData)
|
||||||
setTotalAmount(total)
|
setTotalAmount(total)
|
||||||
setShareOutBonus(waitWithdrawAmountValue)
|
setShareOutBonus(totalReward)
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchBoardsPublicDataAsync())
|
dispatch(fetchBoardsPublicDataAsync())
|
||||||
|
|
@ -106,8 +117,8 @@ const Boards: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<FlexLayout>
|
<FlexLayout>
|
||||||
{boardsList.map((board) => (
|
{boardsList.map((board, index) => (
|
||||||
<BoardCard key={board.pid} board={board} account={account} removed />
|
<BoardCard boardsData={boardsDataList[index]} key={board.pid} board={board} account={account} removed />
|
||||||
))}
|
))}
|
||||||
</FlexLayout>
|
</FlexLayout>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -115,6 +126,7 @@ const Boards: React.FC = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<PageContent>
|
||||||
<Page>
|
<Page>
|
||||||
<Header>
|
<Header>
|
||||||
<Heading as="h1" size="xl" color="text" mb="10px" mt="10px">
|
<Heading as="h1" size="xl" color="text" mb="10px" mt="10px">
|
||||||
|
|
@ -130,6 +142,7 @@ const Boards: React.FC = () => {
|
||||||
</Header>
|
</Header>
|
||||||
{renderContent()}
|
{renderContent()}
|
||||||
</Page>
|
</Page>
|
||||||
|
</PageContent>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
import React, { useMemo, useState, useEffect } from 'react'
|
||||||
|
import styled, { keyframes } from 'styled-components'
|
||||||
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
import { Flex, Text, Button } from '@pancakeswap/uikit'
|
||||||
|
|
||||||
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
|
import UnlockButton from 'components/UnlockButton'
|
||||||
|
import ExchangeInput from './ExchangeInput'
|
||||||
|
|
||||||
|
const FCard = styled.div`
|
||||||
|
width: 650px;
|
||||||
|
background: ${(props) => props.theme.card.background};
|
||||||
|
border-radius: 32px;
|
||||||
|
box-shadow: 0px 2px 30px 0px rgba(0, 0, 0, 0.1);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
position: relative;
|
||||||
|
text-align: center;
|
||||||
|
padding: 50px 70px;
|
||||||
|
`
|
||||||
|
const HeaderText = styled(Text)`
|
||||||
|
font-size: 48px;
|
||||||
|
color: #280d5f;
|
||||||
|
`
|
||||||
|
const TimeText = styled(Text)`
|
||||||
|
color: #7a6eaa;
|
||||||
|
font-size: 22px;
|
||||||
|
`
|
||||||
|
|
||||||
|
const RateText = styled(Text)`
|
||||||
|
font-size: 30px;
|
||||||
|
color: #280d5f;
|
||||||
|
`
|
||||||
|
const RateNumber = styled(Text)`
|
||||||
|
font-size: 30px;
|
||||||
|
color: #1fc7d4;
|
||||||
|
`
|
||||||
|
const FooterButton = styled.div`
|
||||||
|
margin-top: 50px;
|
||||||
|
width: 100%;
|
||||||
|
`
|
||||||
|
const UnlockButtonDiv = styled(UnlockButton)`
|
||||||
|
width: 100%;
|
||||||
|
`
|
||||||
|
|
||||||
|
const ExchangeCard: React.FC = () => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
const account = useAccount()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<FCard>
|
||||||
|
<HeaderText>{t('IDO exchange in the first phase')}</HeaderText>
|
||||||
|
<TimeText>{t('Opening time of next exchange period:')}2022.5.16 00:00</TimeText>
|
||||||
|
<ExchangeInput name="USDT" />
|
||||||
|
<Flex alignItems="center" justifyContent="center" marginTop={20}>
|
||||||
|
<RateText>{t('Exchange rate')}:</RateText>
|
||||||
|
<RateNumber>1USDT=100HCC</RateNumber>
|
||||||
|
</Flex>
|
||||||
|
<Flex alignItems="center" justifyContent="center">
|
||||||
|
<Text color="textSubtle">{t('gross')}:100000HCC</Text>
|
||||||
|
<Text color="textSubtle" marginLeft={20}>
|
||||||
|
{t('remaining quantity')}:100000HCC
|
||||||
|
</Text>
|
||||||
|
</Flex>
|
||||||
|
<ExchangeInput name="HCC" />
|
||||||
|
<FooterButton>
|
||||||
|
{account ? <Button width="100%">{t('Immediately change')}</Button> : <UnlockButtonDiv />}
|
||||||
|
</FooterButton>
|
||||||
|
</FCard>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ExchangeCard
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
import React from 'react'
|
||||||
|
import styled from 'styled-components'
|
||||||
|
import { Text, Input } from '@pancakeswap/uikit'
|
||||||
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
|
||||||
|
const PriceContent = styled.div`
|
||||||
|
height: 148px;
|
||||||
|
background: rgba(238, 234, 244, 0.39);
|
||||||
|
border: 1px solid #d7caec;
|
||||||
|
box-shadow: 0px 2px 6px rgba(0, 0, 0, 0.16);
|
||||||
|
border-radius: 18px;
|
||||||
|
padding: 23px 20px;
|
||||||
|
margin-top: 20px;
|
||||||
|
`
|
||||||
|
const CoinText = styled(Text)`
|
||||||
|
font-size: 26px;
|
||||||
|
color: #333333;
|
||||||
|
text-align: left;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
`
|
||||||
|
|
||||||
|
interface InputProps {
|
||||||
|
name: string
|
||||||
|
value?: number | string
|
||||||
|
}
|
||||||
|
|
||||||
|
const ExchangeInput: React.FC<InputProps> = ({ name, value }) => {
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PriceContent>
|
||||||
|
<CoinText>{name}</CoinText>
|
||||||
|
<Input value={value} placeholder={t('Please enter the amount')} />
|
||||||
|
</PriceContent>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ExchangeInput
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
import React, { useState, useEffect } from 'react'
|
||||||
|
import styled from 'styled-components'
|
||||||
|
import ExchangeCard from './components/ExchangeCard'
|
||||||
|
|
||||||
|
const PageContent = styled.div`
|
||||||
|
min-height: calc(100vh - 64px);
|
||||||
|
background-image: url('/images/recommend/bg.svg');
|
||||||
|
background-size: cover;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
`
|
||||||
|
|
||||||
|
const Exchange: React.FC = () => {
|
||||||
|
return (
|
||||||
|
<PageContent>
|
||||||
|
<ExchangeCard />
|
||||||
|
</PageContent>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
export default Exchange
|
||||||
|
|
@ -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 { Flex, Heading, Text, Box, Stepper, Step, Card } from '@pancakeswap/uikit'
|
import { Flex, Heading, Text, Box, Stepper, Step, Card } from '@pancakeswap/uikit'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
|
@ -39,13 +39,20 @@ const FlexMain = styled(Flex)`
|
||||||
`
|
`
|
||||||
|
|
||||||
const CardDiv = styled(Card)`
|
const CardDiv = styled(Card)`
|
||||||
padding: 20px;
|
padding: 10px 20px;
|
||||||
|
width: 350px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
`
|
`
|
||||||
|
|
||||||
const CourseCom: React.FC = () => {
|
const CourseCom: React.FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
||||||
const [list, setListState] = useState([
|
const [list, setListState] = useState([])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setListState([
|
||||||
{
|
{
|
||||||
title: t('Stage one: Origin'),
|
title: t('Stage one: Origin'),
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
@ -90,17 +97,17 @@ const CourseCom: React.FC = () => {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
}, [t])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FirstPage>
|
<FirstPage>
|
||||||
<StyledPage px={['16px', '24px']} mx="auto" maxWidth="1200px">
|
<StyledPage px={['16px', '24px']} mx="auto" maxWidth="1200px">
|
||||||
<FlexMain>
|
<FlexMain>
|
||||||
<div>
|
|
||||||
<Stepper>
|
<Stepper>
|
||||||
{list.map((item, index) => (
|
{list.map((item, index) => (
|
||||||
<Step key={item.id} index={index} status={index % 2 ? 'past' : 'current'}>
|
<Step key={item.id} index={index} status={index % 2 ? 'past' : 'current'}>
|
||||||
<CardDiv>
|
<CardDiv style={{ height: '290px' }}>
|
||||||
<Heading>{item.title}</Heading>
|
<Heading>{item.title}</Heading>
|
||||||
{item.list.map((childItem) => {
|
{item.list.map((childItem) => {
|
||||||
return (
|
return (
|
||||||
|
|
@ -113,7 +120,6 @@ const CourseCom: React.FC = () => {
|
||||||
</Step>
|
</Step>
|
||||||
))}
|
))}
|
||||||
</Stepper>
|
</Stepper>
|
||||||
</div>
|
|
||||||
</FlexMain>
|
</FlexMain>
|
||||||
</StyledPage>
|
</StyledPage>
|
||||||
</FirstPage>
|
</FirstPage>
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { useDispatch } from 'react-redux'
|
||||||
import { uccnDetail, indexInfo } from 'services/user'
|
import { uccnDetail, indexInfo } from 'services/user'
|
||||||
import { Flex, Heading, Text, Box, Button, Image, Link } from '@pancakeswap/uikit'
|
import { Flex, Heading, Text, Box, Button, Image, Link } from '@pancakeswap/uikit'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
|
import { usePriceHccUsdt } from 'state/hooks'
|
||||||
import { OutLink } from 'types/user'
|
import { OutLink } from 'types/user'
|
||||||
|
|
||||||
import FlexItemCom from './FlexItemCom'
|
import FlexItemCom from './FlexItemCom'
|
||||||
|
|
@ -137,7 +138,9 @@ const FristCom: React.FC = () => {
|
||||||
externalLinkList: [],
|
externalLinkList: [],
|
||||||
userCount: '',
|
userCount: '',
|
||||||
volume: '',
|
volume: '',
|
||||||
|
market: 0,
|
||||||
})
|
})
|
||||||
|
const hccPriceUsdt = usePriceHccUsdt()
|
||||||
const [linkList, setLinkList] = useState([])
|
const [linkList, setLinkList] = useState([])
|
||||||
|
|
||||||
const getDetail = async () => {
|
const getDetail = async () => {
|
||||||
|
|
@ -198,7 +201,7 @@ const FristCom: React.FC = () => {
|
||||||
<ScoreDiv>
|
<ScoreDiv>
|
||||||
<FlexItemCom name={t('Number of holders')} valueNum={detail?.userCount} />
|
<FlexItemCom name={t('Number of holders')} valueNum={detail?.userCount} />
|
||||||
<FlexItemCom name={t('Your volume')} valueNum={detail?.volume} />
|
<FlexItemCom name={t('Your volume')} valueNum={detail?.volume} />
|
||||||
<FlexItemCom name={t('market value')} valueNum={0} />
|
<FlexItemCom name={t('market value')} valueNum={detail?.market * Number(hccPriceUsdt) || 0} />
|
||||||
{/* {burned.map((item) => {
|
{/* {burned.map((item) => {
|
||||||
return <FlexItemCom key={item.id} name={item.name} value={item.value} />
|
return <FlexItemCom key={item.id} name={item.name} value={item.value} />
|
||||||
})} */}
|
})} */}
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ const IntroduceCom: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<FirstPage>
|
<FirstPage>
|
||||||
<StyledPage px={['16px', '24px']} mx="auto" maxWidth="1200px">
|
<StyledPage px={['16px', '24px']} mx="auto">
|
||||||
<BoxMain>
|
<BoxMain>
|
||||||
<MainDiv>
|
<MainDiv>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,13 @@ const Btn = styled(Button)`
|
||||||
background: linear-gradient(180deg, #7be0fc 0%, #ac7bf1 100%);
|
background: linear-gradient(180deg, #7be0fc 0%, #ac7bf1 100%);
|
||||||
border: none;
|
border: none;
|
||||||
`
|
`
|
||||||
|
const AuthorizationBtn = styled(Button)`
|
||||||
|
width: 40%;
|
||||||
|
margin: 20px auto 0px auto;
|
||||||
|
border-radius: 50px;
|
||||||
|
background: linear-gradient(180deg, #7be0fc 0%, #ac7bf1 100%);
|
||||||
|
border: none;
|
||||||
|
`
|
||||||
const BuyActions: React.FC = () => {
|
const BuyActions: React.FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const account = useAccount()
|
const account = useAccount()
|
||||||
|
|
@ -95,25 +102,25 @@ const BuyActions: React.FC = () => {
|
||||||
return (
|
return (
|
||||||
<Flex>
|
<Flex>
|
||||||
{!allowanceList.usdt && (
|
{!allowanceList.usdt && (
|
||||||
<Btn
|
<AuthorizationBtn
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleApprove(onUsdtApprove)
|
handleApprove(onUsdtApprove)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Approve %coin% Contract', { coin: 'usdt' })}
|
{t('Approve %coin% Contract', { coin: 'USDT' })}
|
||||||
</Btn>
|
</AuthorizationBtn>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!allowanceList.hcc && (
|
{!allowanceList.hcc && (
|
||||||
<Btn
|
<AuthorizationBtn
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleApprove(onHccApprove)
|
handleApprove(onHccApprove)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Approve %coin% Contract', { coin: 'hcc' })}
|
{t('Approve %coin% Contract', { coin: 'HCC' })}
|
||||||
</Btn>
|
</AuthorizationBtn>
|
||||||
)}
|
)}
|
||||||
{allowanceList?.usdt && allowanceList.hcc ? (
|
{allowanceList?.usdt && allowanceList.hcc ? (
|
||||||
<Btn disabled={loading} onClick={handleBuy}>
|
<Btn disabled={loading} onClick={handleBuy}>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
import React from 'react'
|
import React, { useState, useMemo, useEffect } 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 { getContract } from 'services/referral'
|
||||||
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: 50%;
|
||||||
|
|
||||||
${({ theme }) => theme.mediaQueries.xs} {
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
}
|
}
|
||||||
|
|
@ -43,6 +44,18 @@ const ImageDiv = styled(Image)`
|
||||||
height: 300px;
|
height: 300px;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
const TextDiv = styled(Text)`
|
||||||
|
text-align: center;
|
||||||
|
height: 45px;
|
||||||
|
opacity: 0.5;
|
||||||
|
border-radius: 23px;
|
||||||
|
font-size: 26px;
|
||||||
|
color: #280d5f;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
`
|
||||||
|
|
||||||
interface BuyNftModalProps {
|
interface BuyNftModalProps {
|
||||||
onDismiss?: () => void
|
onDismiss?: () => void
|
||||||
}
|
}
|
||||||
|
|
@ -50,15 +63,37 @@ 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('')
|
||||||
|
const [link, setLink] = useState('')
|
||||||
|
|
||||||
|
const getLinkAddress = async () => {
|
||||||
|
const data = await getContract()
|
||||||
|
setLink(data)
|
||||||
|
}
|
||||||
|
useEffect(() => {
|
||||||
|
getLinkAddress()
|
||||||
|
}, [])
|
||||||
|
useMemo(() => {
|
||||||
|
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')}${referralCommanderConfigInfo.properties.name}`} onDismiss={onDismiss}>
|
<ModalDiv title={`${t('purchase')}${referralRewardInfo.properties?.name as string}`} onDismiss={onDismiss}>
|
||||||
<Flex alignItems="center" flexWrap="wrap" justifyContent="center">
|
<Flex alignItems="center" flexWrap="wrap" justifyContent="center">
|
||||||
|
<Flex flexDirection="column" justifyContent="center">
|
||||||
<ImageDiv
|
<ImageDiv
|
||||||
src={referralCommanderConfigInfo.properties.cover as string}
|
src={referralCommanderConfigInfo.properties?.cover as string}
|
||||||
width={250}
|
width={250}
|
||||||
height={250}
|
height={250}
|
||||||
marginBottom="20px"
|
marginBottom="20px"
|
||||||
/>
|
/>
|
||||||
|
<TextDiv textAlign="center">{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
|
||||||
|
|
@ -69,12 +104,19 @@ const BuyNftModal: React.FC<BuyNftModalProps> = ({ onDismiss }) => {
|
||||||
<TextFlex text={t('Commander NFT can be traded in the NFT market')} color="#F5FFF9" />
|
<TextFlex text={t('Commander NFT can be traded in the NFT market')} color="#F5FFF9" />
|
||||||
<FlexCom
|
<FlexCom
|
||||||
name={t('First stage sharing ratio')}
|
name={t('First stage sharing ratio')}
|
||||||
value={`${formatDivNumber(referralRewardInfo.dividendFirst)}%`}
|
value={`${referralCommanderConfigInfo.dividendFirst as number}%`}
|
||||||
/>
|
/>
|
||||||
<FlexCom name={t('Secondary split ratio')} value={`${formatDivNumber(referralRewardInfo.dividendSecond)}%`} />
|
<FlexCom
|
||||||
<FlexCom name={t('Contract address')} value={t('Contract address')} />
|
name={t('Secondary split ratio')}
|
||||||
<FlexCom name={t('Assets agreement')} value={t('Assets agreement')} />
|
value={`${referralCommanderConfigInfo.dividendSecond as number}%`}
|
||||||
<FlexCom name={t('Assets and chain')} value={t('Assets and chain')} />
|
/>
|
||||||
|
<FlexCom
|
||||||
|
name={t('Contract address')}
|
||||||
|
typeLink={`https://bscscan.com/token/${link}`}
|
||||||
|
value={`${link && link.substring(0, 6)}...${link && link.substring(link.length - 4, link.length)}`}
|
||||||
|
/>
|
||||||
|
<FlexCom name={t('Assets agreement')} value="ERC721" />
|
||||||
|
<FlexCom name={t('Assets and chain')} value="BSC" />
|
||||||
</InfoDiv>
|
</InfoDiv>
|
||||||
</Flex>
|
</Flex>
|
||||||
<BuyActions />
|
<BuyActions />
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
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 { fetchReferralInfoAsync } from 'state/actions'
|
||||||
|
import { useAccount } from 'state/userInfo/hooks'
|
||||||
import { formatDivNumber } from 'utils/formatBalance'
|
import { formatDivNumber } from 'utils/formatBalance'
|
||||||
import { useTranslation } from 'contexts/Localization'
|
import { useTranslation } from 'contexts/Localization'
|
||||||
import useToast from 'hooks/useToast'
|
import useToast from 'hooks/useToast'
|
||||||
|
|
@ -54,20 +57,25 @@ const TextDiv = styled(Text)`
|
||||||
`
|
`
|
||||||
|
|
||||||
const ConnectedCom: React.FC = () => {
|
const ConnectedCom: React.FC = () => {
|
||||||
|
const dispatch = useDispatch()
|
||||||
|
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 referralCommanderConfigInfo = useReferralCommanderConfigInfo()
|
|
||||||
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 {
|
||||||
|
dispatch(fetchReferralInfoAsync(account))
|
||||||
await withdraw()
|
await withdraw()
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
toastSuccess(t('Successfully claimed!'))
|
toastSuccess(t('Successfully claimed!'))
|
||||||
|
getGain(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|
@ -76,16 +84,16 @@ const ConnectedCom: React.FC = () => {
|
||||||
<MainDiv>
|
<MainDiv>
|
||||||
<HeaderMain title={t('recommend')} />
|
<HeaderMain title={t('recommend')} />
|
||||||
<>
|
<>
|
||||||
<FlexCom name={t('The lower the number of')} value={`${referralRewardInfo?.inviteNum}(人)`} />
|
<FlexCom name={t('The lower the number of')} value={`${referralRewardInfo?.inviteNum || 0}(${t('person')})`} />
|
||||||
<FlexCom name={t('HCC total revenue')} value={`${referralRewardInfo?.inviteReward}(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}(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>
|
||||||
|
|
@ -96,9 +104,7 @@ const ConnectedCom: React.FC = () => {
|
||||||
<UpBtn onClick={onBuyModal}>{t('Upgrade commander')}</UpBtn>
|
<UpBtn onClick={onBuyModal}>{t('Upgrade commander')}</UpBtn>
|
||||||
</FooterBtn>
|
</FooterBtn>
|
||||||
<FooterDiv>
|
<FooterDiv>
|
||||||
<TextDiv>{`${t(
|
<TextDiv>{t('footer %number% text', { number: `${referralNormalConfigInfo?.dividendFirst || 0}%` })}</TextDiv>
|
||||||
'By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins',
|
|
||||||
)}${formatDivNumber(referralCommanderConfigInfo?.dividendFirst)}%${t('The commission')}`}</TextDiv>
|
|
||||||
{/* <TextDiv color="textSubtle">{t('each time')}</TextDiv>
|
{/* <TextDiv color="textSubtle">{t('each time')}</TextDiv>
|
||||||
<TextDiv color="textSubtle">{t('last bid')}</TextDiv>
|
<TextDiv color="textSubtle">{t('last bid')}</TextDiv>
|
||||||
<TextDiv color="textSubtle">{t('commission fee')}</TextDiv> */}
|
<TextDiv color="textSubtle">{t('commission fee')}</TextDiv> */}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import styled from 'styled-components'
|
import styled from 'styled-components'
|
||||||
import { Flex, Text } from '@pancakeswap/uikit'
|
import { Flex, Text, Link } from '@pancakeswap/uikit'
|
||||||
|
|
||||||
interface FlexProps {
|
interface FlexProps {
|
||||||
name: string
|
name: string
|
||||||
|
|
@ -8,6 +8,7 @@ interface FlexProps {
|
||||||
paddings?: string
|
paddings?: string
|
||||||
leftColor?: string
|
leftColor?: string
|
||||||
rightColor?: string
|
rightColor?: string
|
||||||
|
typeLink?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const FlexDiv = styled(Flex)`
|
const FlexDiv = styled(Flex)`
|
||||||
|
|
@ -15,17 +16,34 @@ const FlexDiv = styled(Flex)`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
`
|
`
|
||||||
|
const TextLink = styled(Text)`
|
||||||
|
border-bottom: 1px solid #7a6eaa;
|
||||||
|
cursor: pointer;
|
||||||
|
`
|
||||||
|
|
||||||
const FlexCom: React.FC<FlexProps> = ({
|
const FlexCom: React.FC<FlexProps> = ({
|
||||||
name,
|
name,
|
||||||
value,
|
value,
|
||||||
paddings = '0px',
|
paddings = '0px',
|
||||||
leftColor = 'text',
|
leftColor = 'text',
|
||||||
rightColor = 'textSubtle',
|
rightColor = 'textSubtle',
|
||||||
|
typeLink,
|
||||||
}) => {
|
}) => {
|
||||||
|
const openPage = () => {
|
||||||
|
console.log(typeLink)
|
||||||
|
window.open(typeLink)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FlexDiv style={{ padding: paddings }}>
|
<FlexDiv style={{ padding: paddings }}>
|
||||||
<Text color={leftColor}>{name}</Text>
|
<Text color={leftColor}>{name}</Text>
|
||||||
|
{typeLink ? (
|
||||||
|
<TextLink color={rightColor} onClick={openPage}>
|
||||||
|
{value}
|
||||||
|
</TextLink>
|
||||||
|
) : (
|
||||||
<Text color={rightColor}>{value}</Text>
|
<Text color={rightColor}>{value}</Text>
|
||||||
|
)}
|
||||||
</FlexDiv>
|
</FlexDiv>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,22 +38,22 @@ const FooterBtn = styled.div`
|
||||||
`
|
`
|
||||||
|
|
||||||
const ContentDiv = styled.div`
|
const ContentDiv = styled.div`
|
||||||
width: 60%;
|
width: 75%;
|
||||||
background: rgba(255, 255, 255, 0.39);
|
background: rgba(255, 255, 255, 0.39);
|
||||||
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: 75%;
|
||||||
|
}
|
||||||
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
|
width: 75%;
|
||||||
|
/* height: 80vh; */
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
${({ theme }) => theme.mediaQueries.lg} {
|
${({ theme }) => theme.mediaQueries.lg} {
|
||||||
width: 60%;
|
width: 50%;
|
||||||
}
|
|
||||||
${({ theme }) => theme.mediaQueries.xs} {
|
|
||||||
width: 90%;
|
|
||||||
height: 80vh;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
@ -84,12 +84,14 @@ const RegimentalCom: React.FC = () => {
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const withdraw = useWithdraw()
|
const withdraw = useWithdraw()
|
||||||
const { toastSuccess } = useToast()
|
const { toastSuccess } = useToast()
|
||||||
|
const [gain, getGain] = useState(true)
|
||||||
const handleWithdraw = async () => {
|
const handleWithdraw = async () => {
|
||||||
setLoading(true)
|
setLoading(true)
|
||||||
try {
|
try {
|
||||||
await withdraw()
|
await withdraw()
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
toastSuccess(t('Successfully claimed!'))
|
toastSuccess(t('Successfully claimed!'))
|
||||||
|
getGain(false)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
|
|
@ -106,46 +108,28 @@ const RegimentalCom: React.FC = () => {
|
||||||
</LogoImage>
|
</LogoImage>
|
||||||
|
|
||||||
<>
|
<>
|
||||||
<FlexCom name={t('The lower the number of')} value={`${referralRewardInfo.inviteNum as number}(人)`} />
|
<FlexCom
|
||||||
<FlexCom name={t('total revenue')} value={`${referralRewardInfo.inviteReward as number}(HCC)`} />
|
name={t('The lower the number of')}
|
||||||
|
value={`${(referralRewardInfo.inviteNum as number) || 0}(${t('person')})`}
|
||||||
|
/>
|
||||||
|
<FlexCom name={t('total revenue')} value={`${(referralRewardInfo.inviteReward as number) || 0}(HCC)`} />
|
||||||
<FlexCom
|
<FlexCom
|
||||||
name={t('revenue')}
|
name={t('revenue')}
|
||||||
value={`${
|
value={`${gain ? referralRewardInfo.inviteReward - referralRewardInfo.inviteRewardReceive || 0 : 0}(HCC)`}
|
||||||
((referralRewardInfo.inviteReward as number) - referralRewardInfo.inviteRewardReceive) as number
|
|
||||||
}(HCC)`}
|
|
||||||
/>
|
/>
|
||||||
<FlexCom
|
<FlexCom
|
||||||
name={t('First stage sharing ratio')}
|
name={t('First stage sharing ratio')}
|
||||||
value={`${formatDivNumber(referralCommanderConfigInfo.dividendFirst as number)}%`}
|
value={`${referralCommanderConfigInfo.dividendFirst as number}%`}
|
||||||
/>
|
/>
|
||||||
<FlexCom
|
<FlexCom
|
||||||
name={t('Secondary split ratio')}
|
name={t('Secondary split ratio')}
|
||||||
value={`${formatDivNumber(referralCommanderConfigInfo.dividendSecond as number)}%`}
|
value={`${referralCommanderConfigInfo.dividendSecond as number}%`}
|
||||||
/>
|
/>
|
||||||
{/* <FlexCom name={t('First stage sharing ratio')} value="100000(人)" />
|
|
||||||
<FlexCom
|
|
||||||
name={t('HCC total revenue percentage :10%')}
|
|
||||||
paddings="0 10px"
|
|
||||||
leftColor="textSubtle"
|
|
||||||
value={`${referralCommanderConfigInfo.dividendFirst}%`}
|
|
||||||
/>
|
|
||||||
<FlexCom name={t('Number of secondary subordinates')} value="100000.00(人)" />
|
|
||||||
<FlexCom
|
|
||||||
name={t('HCC total revenue percentage :10%')}
|
|
||||||
paddings="0 10px"
|
|
||||||
leftColor="textSubtle"
|
|
||||||
value="100000.00(HCC)"
|
|
||||||
/>
|
|
||||||
<FlexCom name={t('HCC total revenue')} value={`${referralRewardInfo.inviteReward}(HCC)`} />
|
|
||||||
<FlexCom
|
|
||||||
name={t('To get profit')}
|
|
||||||
value={`${referralRewardInfo.inviteReward - referralRewardInfo.inviteRewardReceive}(HCC)`}
|
|
||||||
/> */}
|
|
||||||
</>
|
</>
|
||||||
|
|
||||||
<FooterBtn>
|
<FooterBtn>
|
||||||
{referralCommanderConfigInfo?.receiveLimit <=
|
{referralCommanderConfigInfo?.receiveLimit <=
|
||||||
referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive ? (
|
referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive && gain ? (
|
||||||
<ButtonGet variant="secondary" disabled={loading} onClick={handleWithdraw}>
|
<ButtonGet variant="secondary" disabled={loading} onClick={handleWithdraw}>
|
||||||
{t('Claim now')}
|
{t('Claim now')}
|
||||||
</ButtonGet>
|
</ButtonGet>
|
||||||
|
|
@ -156,9 +140,11 @@ const RegimentalCom: React.FC = () => {
|
||||||
{/* <UpBtn>{t('Upgrade commander')}</UpBtn> */}
|
{/* <UpBtn>{t('Upgrade commander')}</UpBtn> */}
|
||||||
</FooterBtn>
|
</FooterBtn>
|
||||||
<FooterDiv>
|
<FooterDiv>
|
||||||
<TextDiv>{`${t(
|
<TextDiv>
|
||||||
'By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins',
|
{t('footer %number% text', {
|
||||||
)}${formatDivNumber(referralCommanderConfigInfo?.dividendFirst)}%${t('The commission')}`}</TextDiv>
|
number: `${referralCommanderConfigInfo?.dividendFirst || 0}%`,
|
||||||
|
})}
|
||||||
|
</TextDiv>
|
||||||
{/* <TextDiv color="textSubtle">{t('each time')}</TextDiv>
|
{/* <TextDiv color="textSubtle">{t('each time')}</TextDiv>
|
||||||
<TextDiv color="textSubtle">{t('last bid')}</TextDiv>
|
<TextDiv color="textSubtle">{t('last bid')}</TextDiv>
|
||||||
<TextDiv color="textSubtle">{t('commission fee')}</TextDiv> */}
|
<TextDiv color="textSubtle">{t('commission fee')}</TextDiv> */}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,6 @@ const FooterDiv = styled.div`
|
||||||
margin: 0 auto 30px auto;
|
margin: 0 auto 30px auto;
|
||||||
margin-left: 10%;
|
margin-left: 10%;
|
||||||
`
|
`
|
||||||
const TextDiv = styled(Text)`
|
|
||||||
margin-top: 10px;
|
|
||||||
font-size: 14px;
|
|
||||||
`
|
|
||||||
|
|
||||||
const UnunitedCom: React.FC = () => {
|
const UnunitedCom: React.FC = () => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
|
|
|
||||||
|
|
@ -19,20 +19,21 @@ const MainDiv = styled.div`
|
||||||
`
|
`
|
||||||
|
|
||||||
const ContentDiv = styled.div`
|
const ContentDiv = styled.div`
|
||||||
width: 60%;
|
width: 50%;
|
||||||
|
background: rgba(255, 255, 255, 0.39);
|
||||||
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16);
|
||||||
|
border-radius: 40px;
|
||||||
|
`
|
||||||
|
const ContentUnunited = styled.div`
|
||||||
|
width: 30%;
|
||||||
background: rgba(255, 255, 255, 0.39);
|
background: rgba(255, 255, 255, 0.39);
|
||||||
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} {
|
|
||||||
width: 60%;
|
|
||||||
}
|
|
||||||
|
|
||||||
${({ theme }) => theme.mediaQueries.lg} {
|
|
||||||
width: 60%;
|
|
||||||
}
|
|
||||||
${({ theme }) => theme.mediaQueries.xs} {
|
${({ theme }) => theme.mediaQueries.xs} {
|
||||||
width: 90%;
|
width: 80%;
|
||||||
|
}
|
||||||
|
${({ theme }) => theme.mediaQueries.lg} {
|
||||||
|
width: 30%;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|
@ -43,23 +44,46 @@ const Nft: React.FC = () => {
|
||||||
const referralIsCommander = useReferralIsCommander()
|
const referralIsCommander = useReferralIsCommander()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(fetchReferralInfoAsync(account))
|
dispatch(fetchReferralInfoAsync(account))
|
||||||
}, [account])
|
}, [account, referralIsCommander])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MainDiv>
|
<MainDiv>
|
||||||
{referralIsCommander ? (
|
{account ? (
|
||||||
|
referralIsCommander ? (
|
||||||
|
<RegimentalCom />
|
||||||
|
) : (
|
||||||
|
<ContentDiv>
|
||||||
|
<ConnectedCom />
|
||||||
|
</ContentDiv>
|
||||||
|
)
|
||||||
|
) : (
|
||||||
|
<ContentUnunited>
|
||||||
|
<UnunitedCom />
|
||||||
|
</ContentUnunited>
|
||||||
|
)}
|
||||||
|
{/* {referralIsCommander ? (
|
||||||
<>
|
<>
|
||||||
{account ? (
|
{account ? (
|
||||||
<RegimentalCom />
|
<RegimentalCom />
|
||||||
) : (
|
) : (
|
||||||
<ContentDiv>
|
<ContentUnunited>
|
||||||
<UnunitedCom />
|
<UnunitedCom />
|
||||||
</ContentDiv>
|
</ContentUnunited>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<ContentDiv>{account ? <ConnectedCom /> : <UnunitedCom />}</ContentDiv>
|
<>
|
||||||
|
{account ? (
|
||||||
|
<ContentDiv>
|
||||||
|
<ConnectedCom />
|
||||||
|
</ContentDiv>
|
||||||
|
) : (
|
||||||
|
<ContentUnunited>
|
||||||
|
<UnunitedCom />
|
||||||
|
</ContentUnunited>
|
||||||
)}
|
)}
|
||||||
|
</>
|
||||||
|
)} */}
|
||||||
</MainDiv>
|
</MainDiv>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue