From 3841c754f21aec9965babf723724b404cd7197c8 Mon Sep 17 00:00:00 2001 From: myf <> Date: Thu, 28 Apr 2022 23:58:30 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E9=83=A8=E5=88=86=E8=91=A3=E4=BA=8B?= =?UTF-8?q?=E4=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/zh-CN.json | 5 +- src/config/abi/boardPool.json | 198 ++++++++++++++++++ src/config/abi/holderPool.json | 182 ++++++++++++++++ src/config/constants/boards.ts | 4 + src/config/constants/contracts.ts | 4 +- src/config/constants/types.ts | 1 + src/config/localization/translations.json | 131 ++++++------ src/utils/formatBalance.ts | 4 + .../Board/components/BoardCard/BoardCard.tsx | 21 +- .../Board/components/BoardCard/FlexText.tsx | 18 ++ src/views/Board/index.tsx | 51 ++++- src/views/Referral/components/BuyNftModal.tsx | 8 +- src/views/Referral/components/Connected.tsx | 5 +- src/views/Referral/components/Regimental.tsx | 18 +- 14 files changed, 568 insertions(+), 82 deletions(-) create mode 100644 src/config/abi/boardPool.json create mode 100644 src/config/abi/holderPool.json create mode 100644 src/views/Board/components/BoardCard/FlexText.tsx diff --git a/public/locales/zh-CN.json b/public/locales/zh-CN.json index 1edfa37..6d71ba7 100644 --- a/public/locales/zh-CN.json +++ b/public/locales/zh-CN.json @@ -1119,5 +1119,8 @@ "The commission": "的提成!", "market value": "市值", "Loaded all": "已加载全部", - "Insufficient Balance": "余额不足" + "Insufficient Balance": "余额不足", + "HCC Currency amount": "HCC币总量", + "Lock up time": "锁仓时间", + "possess LP": "持有LP" } diff --git a/src/config/abi/boardPool.json b/src/config/abi/boardPool.json new file mode 100644 index 0000000..49938af --- /dev/null +++ b/src/config/abi/boardPool.json @@ -0,0 +1,198 @@ +[ + { + "inputs": [ + { "internalType": "contract IERC20", "name": "_HCC", "type": "address" }, + { "internalType": "address", "name": "_HCCBODReawardPool", "type": "address" }, + { "internalType": "uint256", "name": "_minStakeAmount", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "EmergencyWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Harvest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "newHCCBODReawardPool", "type": "address" }], + "name": "SetHCCBODReawardPoolEvent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newLockTime", "type": "uint256" }], + "name": "SetLockTimeEvent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newMinStakeAmount", "type": "uint256" }], + "name": "SetMinStakeAmontEvent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "HCC", + "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HCCBODReawardPool", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_poolInfo", + "outputs": [ + { "internalType": "uint256", "name": "accHCCPerShare", "type": "uint256" }, + { "internalType": "uint256", "name": "totalAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "num", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], + "name": "_userInfo", + "outputs": [ + { "internalType": "uint256", "name": "total", "type": "uint256" }, + { "internalType": "uint256", "name": "reward", "type": "uint256" }, + { "internalType": "uint256", "name": "lp", "type": "uint256" }, + { "internalType": "uint256", "name": "lockTime", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_amount", "type": "uint256" }], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "emergencyWithdrawHCC", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { "inputs": [], "name": "harvest", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "lockTime", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minStakeAmount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], + "name": "pendingHCC", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "_HCCBODReawardPool", "type": "address" }], + "name": "setHCCBODReawardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_lockTime", "type": "uint256" }], + "name": "setLockTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_minStakeAmount", "type": "uint256" }], + "name": "setMinStakeAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "setPause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "updatePool", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "userInfo", + "outputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" }, + { "internalType": "uint256", "name": "unLockTime", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "withdrawHCC", "outputs": [], "stateMutability": "nonpayable", "type": "function" } +] diff --git a/src/config/abi/holderPool.json b/src/config/abi/holderPool.json new file mode 100644 index 0000000..bc3215b --- /dev/null +++ b/src/config/abi/holderPool.json @@ -0,0 +1,182 @@ +[ + { + "inputs": [ + { "internalType": "contract IERC20", "name": "_HCC", "type": "address" }, + { "internalType": "address", "name": "_HCCStakeReawardPool", "type": "address" }, + { "internalType": "uint256", "name": "_minStakeAmount", "type": "uint256" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "EmergencyWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Harvest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "newHCCStakeReawardPool", "type": "address" }], + "name": "SetHCCStakeReawardPoolEvent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newLockTime", "type": "uint256" }], + "name": "SetLockTimeEvent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newMinStakeAmount", "type": "uint256" }], + "name": "SetMinStakeAmontEvent", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "HCC", + "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HCCStakeReawardPool", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "_poolInfo", + "outputs": [ + { "internalType": "uint256", "name": "accHCCPerShare", "type": "uint256" }, + { "internalType": "uint256", "name": "totalAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "num", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], + "name": "_userInfo", + "outputs": [ + { "internalType": "uint256", "name": "total", "type": "uint256" }, + { "internalType": "uint256", "name": "reward", "type": "uint256" }, + { "internalType": "uint256", "name": "lp", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_amount", "type": "uint256" }], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "emergencyWithdrawHCC", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { "inputs": [], "name": "harvest", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "minStakeAmount", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], + "name": "pendingHCC", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "_HCCStakeReawardPool", "type": "address" }], + "name": "setHCCStakeReawardPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_minStakeAmount", "type": "uint256" }], + "name": "setMinStakeAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "setPause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "updatePool", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "userInfo", + "outputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "withdrawHCC", "outputs": [], "stateMutability": "nonpayable", "type": "function" } +] diff --git a/src/config/constants/boards.ts b/src/config/constants/boards.ts index 2213da9..3c662de 100644 --- a/src/config/constants/boards.ts +++ b/src/config/constants/boards.ts @@ -1,6 +1,8 @@ import addresses from 'config/constants/contracts' import boardAbi from 'config/abi/board.json' +import boardPoolAbi from 'config/abi/boardPool.json' import holderAbi from 'config/abi/holder.json' +import holderPoolAbis from 'config/abi/holderPool.json' import tokens from './tokens' import { BoardConfig } from './types' @@ -15,6 +17,7 @@ const boardsList: BoardConfig[] = [ contractAddress: addresses.boardChef, contractRewardAddress: addresses.boardRewardChef, abi: boardAbi, + poolAbi: boardPoolAbi, }, { pid: 2, @@ -26,6 +29,7 @@ const boardsList: BoardConfig[] = [ contractAddress: addresses.holderChef, contractRewardAddress: addresses.holderRewardChef, abi: holderAbi, + poolAbi: holderPoolAbis, }, ] diff --git a/src/config/constants/contracts.ts b/src/config/constants/contracts.ts index 6f79a7e..11e8b54 100644 --- a/src/config/constants/contracts.ts +++ b/src/config/constants/contracts.ts @@ -8,7 +8,7 @@ export default { 56: '0x6ab8463a4185b80905e05a9ff80a2d6b714b9e95', }, boardChef: { - 97: '0xcf5411e9bd61bbd68ddf08e8a3f7680af8993cd0', + 97: '0x0e28f80e6560f0ebbba4bbdf155a946053e5056a', 56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会合约 }, boardRewardChef: { @@ -16,7 +16,7 @@ export default { 56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 节点董事会分红合约 }, holderChef: { - 97: '0x20b74dfb41172fdce43758c014959b5e2586d2cf', + 97: '0xafa64f22a09fc197949c45281b2ad381a2b623a3', 56: '0xD34871F12ace1BB8034E18009104b9dA60B84250', // NEED CHANGE 持币人 }, holderRewardChef: { diff --git a/src/config/constants/types.ts b/src/config/constants/types.ts index 23c4ba7..7126189 100644 --- a/src/config/constants/types.ts +++ b/src/config/constants/types.ts @@ -188,5 +188,6 @@ export interface BoardConfig { contractAddress: Address contractRewardAddress: Address abi: any + poolAbi: any // rewardAbi: any } diff --git a/src/config/localization/translations.json b/src/config/localization/translations.json index 54a04f2..b4e22aa 100644 --- a/src/config/localization/translations.json +++ b/src/config/localization/translations.json @@ -1184,68 +1184,71 @@ "Confirm this transaction in your wallet": "Confirm this transaction in your wallet", "Dismiss": "Dismiss", - "Hcc Info":"HighCityCoin abbreviation HCC,cause HighCityTM cast,", - "Hcc Nft":"Its function is mainly in HighCitySwap On the purchase NFT、NFT Boxes and other tradeable products.", - "Hcc BTC":"meanwhile,HCC and BTC、ETH Have the same properties,They can trade freely.", - "Bazaar":"NFT Bazaar", - "HlighCitySwapInfo":"HIighCitySwap the birth of,From the founder Liu Bus Enthusiastic pursuit of blockchain technology,He has always believed that blockchain technology could be used more widely。for this purpose,He made a brave decision,Abandon investments in other areas,Focus on the practical application of blockchain technology,Put yourself in a familiar field -- social networking on the Internet,Integration with blockchain technology,HighCitySwap Thus was born.That's where we started,Thank you for your support,HighCity The team will always move forward.", - "Stage one: Origin":"Stage one: Origin", - "Stage two: Action":"Stage two: Action", - "Stage three: Creation":"Stage three: Creation", - "Stage four: Integration":"Stage four: Integration", - "Stage five: Closing the curtain":"Stage five: Closing the curtain", - "The project concept was born in May 2021":"The project concept was born in May 2021;", - "Set up HighClty team in June 2021":"Set up HighClty team in June 2021;", - "May 2021 -- January 2022 Team run-in":"May 2021 -- January 2022 Team run-in;", - "In April 2022, social networking and media release activities, HighCity coin started and dividend mechanism went online":"In April 2022, social networking and media release activities, HighCity coin started and dividend mechanism went online;", - "In March 2022, project approval, web design, roadmap announcement, smart contract development":"In March 2022, project approval, web design, roadmap announcement, smart contract development;", - "Launch of social software in December 2022":"Launch of social software in December 2022;", - "Created by NFT in May 2022":"Created by NFT in May 2022;", - "June 2022 social software development":"June 2022 social software development;", - "December 2022 NFT bonus binding social software":"December 2022 NFT bonus binding social software;", - "In December 2022, HighCity Ecology was preliminarily completed":"In December 2022, HighCity Ecology was preliminarily completed;", - "HighCity Ecology completed in December 2022":"HighCity Ecology completed in December 2022", - "Maintain dividend income growth in December 2022":"Maintain dividend income growth in December 2022;", - "Buy commander NFT":"Buy commander NFT", - "Upgrade recommendation rights, can enjoy the share of secondary recommendation":"Upgrade recommendation rights, can enjoy the share of secondary recommendation", - "Enjoy a higher percentage than ordinary users":"Enjoy a higher percentage than ordinary users", - "Commander NFT can be traded in the NFT market":"Commander NFT can be traded in the NFT market", - "First stage sharing ratio":"First stage sharing ratio", - "Secondary split ratio":"Secondary split ratio", - "Buy It Now":"Buy It Now", - "recommend":"recommend", - "The lower the number of":"The lower the number of", - "NFT total revenue":"NFT total revenue", - "HCC total revenue":"HCC total revenue", - "To get profit":"To get profit", - "No income is received temporarily":"No income is received temporarily", - "Upgrade commander":"Upgrade commander", - "Regimental recommendation":"Regimental recommendation", - "Number of secondary subordinates":"Number of secondary subordinates", - "Number of first-level subordinates":"Number of first-level subordinates", - "Immediately to receive":"Immediately to receive", - "buy again":"buy again", - "Connect the purse":"Connect the purse", - "HCC total revenue percentage :10%":"HCC total revenue percentage :10%", - "Contract address":"ontract address", - "Assets agreement":"Assets agreement", - "Assets and chain":"Assets and chain", - "each time":"1. When the countdown is less than 1 hour, the countdown time will be increased by 1 hour each time", - "last bid":"2. Each auction has a fixed 10% markup. After the countdown, the item will be awarded to the bidder who made the last bid", - "commission fee":"3. After the auction is successful, the platform will charge 6% of the publisher's earnings as a commission fee", - "announcement":"announcement", - "return":"return", - "Total capital pool":"Total capital pool", - "The total amount of dividends":"The total amount of dividends", - "Pending dividend":"Pending dividend", - "Number of boards":"Number of boards", - "Number of holders":"Number of holders", - "total revenue":"total revenue", - "revenue":"revenue", - "purchase":"purchase", - "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!", - "market value":"market value", - "Loaded all":"Loaded all" + "Hcc Info": "HighCityCoin abbreviation HCC,cause HighCityTM cast,", + "Hcc Nft": "Its function is mainly in HighCitySwap On the purchase NFT、NFT Boxes and other tradeable products.", + "Hcc BTC": "meanwhile,HCC and BTC、ETH Have the same properties,They can trade freely.", + "Bazaar": "NFT Bazaar", + "HlighCitySwapInfo": "HIighCitySwap the birth of,From the founder Liu Bus Enthusiastic pursuit of blockchain technology,He has always believed that blockchain technology could be used more widely。for this purpose,He made a brave decision,Abandon investments in other areas,Focus on the practical application of blockchain technology,Put yourself in a familiar field -- social networking on the Internet,Integration with blockchain technology,HighCitySwap Thus was born.That's where we started,Thank you for your support,HighCity The team will always move forward.", + "Stage one: Origin": "Stage one: Origin", + "Stage two: Action": "Stage two: Action", + "Stage three: Creation": "Stage three: Creation", + "Stage four: Integration": "Stage four: Integration", + "Stage five: Closing the curtain": "Stage five: Closing the curtain", + "The project concept was born in May 2021": "The project concept was born in May 2021;", + "Set up HighClty team in June 2021": "Set up HighClty team in June 2021;", + "May 2021 -- January 2022 Team run-in": "May 2021 -- January 2022 Team run-in;", + "In April 2022, social networking and media release activities, HighCity coin started and dividend mechanism went online": "In April 2022, social networking and media release activities, HighCity coin started and dividend mechanism went online;", + "In March 2022, project approval, web design, roadmap announcement, smart contract development": "In March 2022, project approval, web design, roadmap announcement, smart contract development;", + "Launch of social software in December 2022": "Launch of social software in December 2022;", + "Created by NFT in May 2022": "Created by NFT in May 2022;", + "June 2022 social software development": "June 2022 social software development;", + "December 2022 NFT bonus binding social software": "December 2022 NFT bonus binding social software;", + "In December 2022, HighCity Ecology was preliminarily completed": "In December 2022, HighCity Ecology was preliminarily completed;", + "HighCity Ecology completed in December 2022": "HighCity Ecology completed in December 2022", + "Maintain dividend income growth in December 2022": "Maintain dividend income growth in December 2022;", + "Buy commander NFT": "Buy commander NFT", + "Upgrade recommendation rights, can enjoy the share of secondary recommendation": "Upgrade recommendation rights, can enjoy the share of secondary recommendation", + "Enjoy a higher percentage than ordinary users": "Enjoy a higher percentage than ordinary users", + "Commander NFT can be traded in the NFT market": "Commander NFT can be traded in the NFT market", + "First stage sharing ratio": "First stage sharing ratio", + "Secondary split ratio": "Secondary split ratio", + "Buy It Now": "Buy It Now", + "recommend": "recommend", + "The lower the number of": "The lower the number of", + "NFT total revenue": "NFT total revenue", + "HCC total revenue": "HCC total revenue", + "To get profit": "To get profit", + "No income is received temporarily": "No income is received temporarily", + "Upgrade commander": "Upgrade commander", + "Regimental recommendation": "Regimental recommendation", + "Number of secondary subordinates": "Number of secondary subordinates", + "Number of first-level subordinates": "Number of first-level subordinates", + "Immediately to receive": "Immediately to receive", + "buy again": "buy again", + "Connect the purse": "Connect the purse", + "HCC total revenue percentage :10%": "HCC total revenue percentage :10%", + "Contract address": "ontract address", + "Assets agreement": "Assets agreement", + "Assets and chain": "Assets and chain", + "each time": "1. When the countdown is less than 1 hour, the countdown time will be increased by 1 hour each time", + "last bid": "2. Each auction has a fixed 10% markup. After the countdown, the item will be awarded to the bidder who made the last bid", + "commission fee": "3. After the auction is successful, the platform will charge 6% of the publisher's earnings as a commission fee", + "announcement": "announcement", + "return": "return", + "Total capital pool": "Total capital pool", + "The total amount of dividends": "The total amount of dividends", + "Pending dividend": "Pending dividend", + "Number of boards": "Number of boards", + "Number of holders": "Number of holders", + "total revenue": "total revenue", + "revenue": "revenue", + "purchase": "purchase", + "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!", + "market value": "market value", + "Loaded all": "Loaded all", + "HCC Currency amount": "HCC Currency amount", + "Lock up time": "Lock up time", + "possess LP": "possess LP" } diff --git a/src/utils/formatBalance.ts b/src/utils/formatBalance.ts index 30a0c32..c5f31e5 100644 --- a/src/utils/formatBalance.ts +++ b/src/utils/formatBalance.ts @@ -64,3 +64,7 @@ export const formatFixedNumber = (number: ethers.FixedNumber, displayDecimals = const [leftSide] = number.toString().split('.') return formatBigNumber(ethers.BigNumber.from(leftSide), displayDecimals, decimals) } + +export const formatDivNumber = (number: number, decimals = 4) => { + return new BigNumber(number).div(BIG_TEN.pow(decimals)).toNumber() +} diff --git a/src/views/Board/components/BoardCard/BoardCard.tsx b/src/views/Board/components/BoardCard/BoardCard.tsx index ff2e6ed..267e3a6 100644 --- a/src/views/Board/components/BoardCard/BoardCard.tsx +++ b/src/views/Board/components/BoardCard/BoardCard.tsx @@ -9,6 +9,7 @@ import ExpandableSectionButton from 'components/ExpandableSectionButton' import DetailsSection from './DetailsSection' import CardHeading from './CardHeading' import CardActionsContainer from './CardActionsContainer' +import FlexText from './FlexText' const RainbowLight = keyframes` 0% { @@ -79,9 +80,10 @@ interface NodeCardProps { removed: boolean provider?: ProviderType account?: string + list?: any } -const NodeCard: React.FC = ({ board, account }) => { +const NodeCard: React.FC = ({ board, account, list }) => { const { t } = useTranslation() const [showExpandableSection, setShowExpandableSection] = useState(false) @@ -89,6 +91,23 @@ const NodeCard: React.FC = ({ board, account }) => { return ( +
+ {list.map((item) => { + return ( +
+ {board.name === item.name ? ( + <> + + {item.name === 'Board' ? : ''} + + + ) : ( + <> + )} +
+ ) + })} +
{/* = ({ name, value }) => { + return ( + + {name} + {value} + + ) +} +export default FlexText diff --git a/src/views/Board/index.tsx b/src/views/Board/index.tsx index fd30ee6..2933c82 100644 --- a/src/views/Board/index.tsx +++ b/src/views/Board/index.tsx @@ -51,6 +51,13 @@ const Boards: React.FC = () => { const [totalAmount, setTotalAmount] = useState(0) // 分红总额 const [shareOutBonus, setShareOutBonus] = useState(0) + + const [boardNum, setBoardNum] = useState(0) + const [holderNum, setHolder] = useState(0) + + const [withdrawAmount, setWithdrawAmount] = useState(0) + + const [boardsDataList, setBoardsDataList] = useState([]) // // 获取资金池总额 // const getCapital = async () => { // const calls = boardsConfig.map((board) => { @@ -85,6 +92,7 @@ const Boards: React.FC = () => { }, ]) return { + name: boardConfig.name, totalAmount: getBalanceAmount(new BigNumber(boardPoolInfo.totalAmount._hex)).toNumber(), num: new BigNumber(boardPoolInfo?.num?._hex).toNumber(), waitWithdrawAmount: getBalanceAmount(new BigNumber(waitWithdrawAmount.balance._hex)).toNumber(), @@ -92,14 +100,47 @@ const Boards: React.FC = () => { }), ) console.log(boardsData) + let total = 0 + let waitWithdrawAmountValue = 0 + boardsData.forEach((item) => { + total += item.totalAmount + waitWithdrawAmountValue += item.waitWithdrawAmount + if (item.name === 'Board') { + setBoardNum(item.num) + } else if (item.name === 'Holder') { + setHolder(item.waitWithdrawAmount) + } + }) + setTotalAmount(total) + setShareOutBonus(waitWithdrawAmountValue) + } + // 获取信息 + const fetchInfo = async () => { + const boardsData = await Promise.all( + boardsConfig.map(async (boardConfig) => { + const [boardUserInfo] = await multicall(boardConfig.poolAbi, [ + { + address: getAddress(boardConfig.contractAddress), + name: 'userInfo', + params: [account], + }, + ]) + return { + name: boardConfig.name, + amount: getBalanceAmount(new BigNumber(boardUserInfo.amount?._hex)).toNumber(), + rewardDebt: getBalanceAmount(new BigNumber(boardUserInfo.rewardDebt?._hex)).toNumber(), + unLockTime: new BigNumber(boardUserInfo?.unLockTime?._hex).toNumber(), + } + }), + ) + setBoardsDataList(boardsData) } - useEffect(() => { dispatch(fetchBoardsPublicDataAsync()) fetchBoardShares() if (account) { + fetchInfo() dispatch(fetchBoardUserDataAsync(account)) - // getCapital() } }, [account, dispatch, fastRefresh]) @@ -108,7 +149,7 @@ const Boards: React.FC = () => {
{boardsList.map((board) => ( - + ))}
@@ -125,8 +166,8 @@ const Boards: React.FC = () => { {/* */} - - + + {renderContent()} diff --git a/src/views/Referral/components/BuyNftModal.tsx b/src/views/Referral/components/BuyNftModal.tsx index e37443e..abee484 100644 --- a/src/views/Referral/components/BuyNftModal.tsx +++ b/src/views/Referral/components/BuyNftModal.tsx @@ -1,5 +1,6 @@ import React from 'react' import styled from 'styled-components' +import { formatDivNumber } from 'utils/formatBalance' import { useTranslation } from 'contexts/Localization' import { useReferralNormalConfigInfo, useReferralCommanderConfigInfo } from 'state/referral/hooks' import { Flex, Button, Modal, Image } from '@pancakeswap/uikit' @@ -66,8 +67,11 @@ const BuyNftModal: React.FC = ({ onDismiss }) => { /> - - + + diff --git a/src/views/Referral/components/Connected.tsx b/src/views/Referral/components/Connected.tsx index 9651bbc..93ffb5b 100644 --- a/src/views/Referral/components/Connected.tsx +++ b/src/views/Referral/components/Connected.tsx @@ -1,5 +1,6 @@ import React from 'react' import styled from 'styled-components' +import { formatDivNumber } from 'utils/formatBalance' import { useTranslation } from 'contexts/Localization' import { Button, useModal, Text } from '@pancakeswap/uikit' import { inviteReceive } from 'services/referral' @@ -55,7 +56,9 @@ const ConnectedCom: React.FC = () => { const { t } = useTranslation() const [onBuyModal] = useModal() const referralNormalConfigInfo = useReferralNormalConfigInfo() + console.log('referralNormalConfigInfo:', referralNormalConfigInfo) const referralRewardInfo = useReferralRewardInfo() + console.log('referralRewardInfo:', referralRewardInfo) const referralCommanderConfigInfo = useReferralCommanderConfigInfo() const getInviteReceive = async () => { await inviteReceive() @@ -86,7 +89,7 @@ const ConnectedCom: React.FC = () => { {`${t( 'By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins', - )}${referralCommanderConfigInfo.dividendFirst / 10000}%${t('The commission')}`} + )}${formatDivNumber(referralCommanderConfigInfo.dividendFirst)}%${t('The commission')}`} {/* {t('each time')} {t('last bid')} {t('commission fee')} */} diff --git a/src/views/Referral/components/Regimental.tsx b/src/views/Referral/components/Regimental.tsx index d88649e..5c3bc6b 100644 --- a/src/views/Referral/components/Regimental.tsx +++ b/src/views/Referral/components/Regimental.tsx @@ -1,5 +1,6 @@ import React from 'react' import styled from 'styled-components' +import { formatDivNumber } from 'utils/formatBalance' import { useTranslation } from 'contexts/Localization' import { inviteReceive } from 'services/referral' import { useReferralCommanderConfigInfo, useReferralRewardInfo } from 'state/referral/hooks' @@ -95,17 +96,22 @@ const RegimentalCom: React.FC = () => { <> - - + + + - {/* { {`${t( 'By using the invitation at the top right of the page, new users can be invited to enter and obtained after users purchase coins', - )}${referralCommanderConfigInfo.dividendFirst / 10000}%${t('The commission')}`} + )}${formatDivNumber(referralCommanderConfigInfo.dividendFirst)}%${t('The commission')}`} {/* {t('each time')} {t('last bid')} {t('commission fee')} */} From b2fb877052a157ad3649ea6779f8f6505a013001 Mon Sep 17 00:00:00 2001 From: myf <> Date: Fri, 29 Apr 2022 15:13:50 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E9=83=A8=E5=88=86=E8=91=A3=E4=BA=8B?= =?UTF-8?q?=E4=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Menu/config.ts | 10 ++++ src/state/boards/fetchBoardsUser.ts | 7 ++- src/state/boards/index.ts | 5 +- .../Board/components/BoardCard/BoardCard.tsx | 28 ++++------- src/views/Board/index.tsx | 50 +++++++++---------- src/views/Home/components/FristCom.tsx | 6 ++- src/views/Referral/components/Connected.tsx | 12 ++--- 7 files changed, 64 insertions(+), 54 deletions(-) diff --git a/src/components/Menu/config.ts b/src/components/Menu/config.ts index 13d99d3..e9ed631 100644 --- a/src/components/Menu/config.ts +++ b/src/components/Menu/config.ts @@ -25,6 +25,16 @@ const config: (t: ContextApi['t']) => MenuEntry[] = (t) => [ // // }, // ], // }, + { + label: t('Exchange'), + icon: 'FarmIcon', + href: 'https://pancake.kiemtienonline360.com/#/swap', + }, + { + label: t('Liquidity'), + icon: 'FarmIcon', + href: 'https://pancake.kiemtienonline360.com/#/pool', + }, { label: t('Farms'), icon: 'FarmIcon', diff --git a/src/state/boards/fetchBoardsUser.ts b/src/state/boards/fetchBoardsUser.ts index 28174d5..13e833c 100644 --- a/src/state/boards/fetchBoardsUser.ts +++ b/src/state/boards/fetchBoardsUser.ts @@ -4,6 +4,7 @@ import boardABI from 'config/abi/board.json' import multicall from 'utils/multicall' import boardsConfig from 'config/constants/boards' import { getAddress, getBoardAddress } from 'utils/addressHelpers' +import { getBalanceAmount } from 'utils/formatBalance' export const fetchBoardUserAllowances = async (account: string) => { const calls = boardsConfig.map((board) => { @@ -53,13 +54,17 @@ export const fetchBoardUserInfo = async (account: string) => { }, ] const [userInfo, estimatedProfit] = await multicall(board.abi, calls) + console.log(userInfo) return { stakedBalance: new BigNumber(userInfo.amount._hex).toJSON(), unLockTime: userInfo.unLockTime ? new BigNumber(userInfo.unLockTime._hex).toNumber() : 0, estimatedProfit: new BigNumber(estimatedProfit).toJSON(), + name: board.name, + amount: getBalanceAmount(new BigNumber(userInfo.amount?._hex)).toNumber(), + rewardDebt: getBalanceAmount(new BigNumber(userInfo.rewardDebt?._hex)).toNumber(), } }), ) - + console.log('data:', data) return data } diff --git a/src/state/boards/index.ts b/src/state/boards/index.ts index a0e9936..4f8a894 100644 --- a/src/state/boards/index.ts +++ b/src/state/boards/index.ts @@ -49,9 +49,12 @@ export const fetchBoardUserDataAsync = (account) => async (dispatch) => { stakedBalance: userInfo[index].stakedBalance, unlockTime: userInfo[index].unLockTime, estimatedProfit: userInfo[index].estimatedProfit, + name: userInfo[index].name, + amount: userInfo[index].amount, + rewardDebt: userInfo[index].rewardDebt, } }) - + console.log(arrayOfUserDataObjects) dispatch(setBoardsUserData({ arrayOfUserDataObjects })) } diff --git a/src/views/Board/components/BoardCard/BoardCard.tsx b/src/views/Board/components/BoardCard/BoardCard.tsx index 267e3a6..b9e5dc9 100644 --- a/src/views/Board/components/BoardCard/BoardCard.tsx +++ b/src/views/Board/components/BoardCard/BoardCard.tsx @@ -3,6 +3,7 @@ import BigNumber from 'bignumber.js' import styled, { keyframes } from 'styled-components' import { Flex, Text, Skeleton } from '@pancakeswap/uikit' import { provider as ProviderType } from 'web3-core' +import { getDecimalAmountNumber } from 'utils/formatBalance' import { getBoardAddress } from 'utils/addressHelpers' import { useTranslation } from 'contexts/Localization' import ExpandableSectionButton from 'components/ExpandableSectionButton' @@ -61,6 +62,7 @@ const FCard = styled.div` padding: 24px; position: relative; text-align: center; + min-height: 310px; ` const Divider = styled.div` @@ -80,33 +82,23 @@ interface NodeCardProps { removed: boolean provider?: ProviderType account?: string - list?: any } -const NodeCard: React.FC = ({ board, account, list }) => { +const NodeCard: React.FC = ({ board, account }) => { const { t } = useTranslation() const [showExpandableSection, setShowExpandableSection] = useState(false) - return (
- {list.map((item) => { - return ( -
- {board.name === item.name ? ( - <> - - {item.name === 'Board' ? : ''} - - - ) : ( - <> - )} -
- ) - })} + + {board.userData?.name === 'Board' ? ( + + ) : ( + '' + )} +
{/* diff --git a/src/views/Board/index.tsx b/src/views/Board/index.tsx index 2933c82..8f505cd 100644 --- a/src/views/Board/index.tsx +++ b/src/views/Board/index.tsx @@ -18,6 +18,7 @@ import Page from 'components/Layout/Page' import { useBoards } from 'state/hooks' import useRefresh from 'hooks/useRefresh' import { fetchBoardUserDataAsync, fetchBoardsPublicDataAsync } from 'state/actions' +import { fetchBoardUserInfo } from 'state/boards/fetchBoardsUser' import { useTranslation } from 'contexts/Localization' import BoardCard from './components/BoardCard/BoardCard' import HeaderItem from './components/HeaderItem' @@ -55,9 +56,6 @@ const Boards: React.FC = () => { const [boardNum, setBoardNum] = useState(0) const [holderNum, setHolder] = useState(0) - const [withdrawAmount, setWithdrawAmount] = useState(0) - - const [boardsDataList, setBoardsDataList] = useState([]) // // 获取资金池总额 // const getCapital = async () => { // const calls = boardsConfig.map((board) => { @@ -99,7 +97,6 @@ const Boards: React.FC = () => { } }), ) - console.log(boardsData) let total = 0 let waitWithdrawAmountValue = 0 boardsData.forEach((item) => { @@ -115,31 +112,32 @@ const Boards: React.FC = () => { setShareOutBonus(waitWithdrawAmountValue) } // 获取信息 - const fetchInfo = async () => { - const boardsData = await Promise.all( - boardsConfig.map(async (boardConfig) => { - const [boardUserInfo] = await multicall(boardConfig.poolAbi, [ - { - address: getAddress(boardConfig.contractAddress), - name: 'userInfo', - params: [account], - }, - ]) - return { - name: boardConfig.name, - amount: getBalanceAmount(new BigNumber(boardUserInfo.amount?._hex)).toNumber(), - rewardDebt: getBalanceAmount(new BigNumber(boardUserInfo.rewardDebt?._hex)).toNumber(), - unLockTime: new BigNumber(boardUserInfo?.unLockTime?._hex).toNumber(), - } - }), - ) - setBoardsDataList(boardsData) - } + // const fetchInfo = async () => { + // const boardsData = await Promise.all( + // boardsConfig.map(async (boardConfig) => { + // const [boardUserInfo] = await multicall(boardConfig.poolAbi, [ + // { + // address: getAddress(boardConfig.contractAddress), + // name: 'userInfo', + // params: [account], + // }, + // ]) + // return { + // name: boardConfig.name, + // amount: getBalanceAmount(new BigNumber(boardUserInfo.amount?._hex)).toNumber(), + // rewardDebt: getBalanceAmount(new BigNumber(boardUserInfo.rewardDebt?._hex)).toNumber(), + // unLockTime: new BigNumber(boardUserInfo?.unLockTime?._hex).toNumber(), + // } + // }), + // ) + // setBoardsDataList(boardsData) + // } useEffect(() => { dispatch(fetchBoardsPublicDataAsync()) fetchBoardShares() if (account) { - fetchInfo() + // fetchInfo() + // const userInfo = fetchBoardUserInfo(account) dispatch(fetchBoardUserDataAsync(account)) } }, [account, dispatch, fastRefresh]) @@ -149,7 +147,7 @@ const Boards: React.FC = () => {
{boardsList.map((board) => ( - + ))}
diff --git a/src/views/Home/components/FristCom.tsx b/src/views/Home/components/FristCom.tsx index 0d2ea98..e4a2ff5 100644 --- a/src/views/Home/components/FristCom.tsx +++ b/src/views/Home/components/FristCom.tsx @@ -162,8 +162,10 @@ const FristCom: React.FC = () => { {t('Hcc Nft')} {t('Hcc BTC')} - {t('Exchange')} - {t('Bazaar')} + openLink('https://pancake.kiemtienonline360.com/#/swap')}> + {t('Exchange')} + + {/* {t('Bazaar')} */} {detail.outsideChainVos.map((item) => { return ( diff --git a/src/views/Referral/components/Connected.tsx b/src/views/Referral/components/Connected.tsx index 93ffb5b..e36bb2b 100644 --- a/src/views/Referral/components/Connected.tsx +++ b/src/views/Referral/components/Connected.tsx @@ -67,16 +67,16 @@ const ConnectedCom: React.FC = () => { <> - - + + - {referralNormalConfigInfo.receiveLimit <= - referralRewardInfo.inviteReward - referralRewardInfo.inviteRewardReceive ? ( + {referralNormalConfigInfo?.receiveLimit <= + referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive ? ( {t('Claim now')} @@ -89,7 +89,7 @@ const ConnectedCom: React.FC = () => { {`${t( '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')}`} + )}${formatDivNumber(referralCommanderConfigInfo?.dividendFirst)}%${t('The commission')}`} {/* {t('each time')} {t('last bid')} {t('commission fee')} */} From 089d6f8ade35e20461c65d048712909a17b4f7c8 Mon Sep 17 00:00:00 2001 From: myf <> Date: Fri, 29 Apr 2022 16:20:02 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E9=83=A8=E5=88=86=E8=91=A3=E4=BA=8B?= =?UTF-8?q?=E4=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.production | 4 ++++ src/views/Announcement/index.tsx | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.env.production b/.env.production index 3a8a270..650be63 100644 --- a/.env.production +++ b/.env.production @@ -16,3 +16,7 @@ REACT_APP_GRAPH_API_LOTTERY = "https://api.thegraph.com/subgraphs/name/pancakesw REACT_APP_SNAPSHOT_BASE_URL = "https://hub.snapshot.page" REACT_APP_SNAPSHOT_VOTING_API = "https://voting-api.pancakeswap.info/api" + + +REACT_APP_REQUEST_URL = 'http://101.35.117.69:9090' +# REACT_APP_REQUEST_URL = 'http://192.168.2.210:8080' \ No newline at end of file diff --git a/src/views/Announcement/index.tsx b/src/views/Announcement/index.tsx index a0ae578..76cf6ef 100644 --- a/src/views/Announcement/index.tsx +++ b/src/views/Announcement/index.tsx @@ -1,7 +1,7 @@ import React, { useState, useEffect, useMemo, useRef } from 'react' import styled from 'styled-components' import { useTranslation } from 'contexts/Localization' -import Container from 'components/Layout/Container' +// import Container from 'components/Layout/Container' import { getAnnouncementPage, getAnnouncementDetail } from 'services/announcement' import { Text, Flex, Image, Input, Heading } from '@pancakeswap/uikit' import ListItem from './components/ListItem' @@ -12,9 +12,9 @@ interface DetailProps { content?: string publishTime?: number } -const ContainerMain = styled(Container)` +const ContainerMain = styled.div` background: ${({ theme }) => theme.colors.gradients.bubblegum}; - padding: 30px 0; + /* padding: 30px 0; */ ` const MainDiv = styled.div` width: 100%; @@ -130,10 +130,18 @@ const Announcement: React.FC = () => { const [list, setList] = useState([]) const [totalVisible, setTotalVisible] = useState(false) const [detailData, setDetailData] = useState({ title: '', publishTime: 0, content: '' }) - const getList = async (page: number, size: number, title?: string) => { + const getList = async (page: number, size: number, title?: string, type?: string) => { if (totalVisible) return + if (type) { + setList([]) + } const data = await getAnnouncementPage({ page, size, title }) - const dataList = [...list, ...data.content] + let dataList = [] + if (type) { + dataList = data.content + } else { + dataList = [...list, ...data.content] + } setList(dataList) if (data.content.length === 0 || !data.content) { setTotalVisible(true) @@ -166,7 +174,8 @@ const Announcement: React.FC = () => { } const searchList = () => { setList([]) - getList(1, 10, searchTitle) + setTotalVisible(false) + getList(1, 10, searchTitle, 'search') } const close = () => { setDetailVisible(false) From dacee4d94160ad317f17f114926b8b2b49a4c2be Mon Sep 17 00:00:00 2001 From: myf <> Date: Fri, 29 Apr 2022 17:35:20 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E5=85=AC=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/Announcement/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/Announcement/index.tsx b/src/views/Announcement/index.tsx index 76cf6ef..6cfe72f 100644 --- a/src/views/Announcement/index.tsx +++ b/src/views/Announcement/index.tsx @@ -14,7 +14,7 @@ interface DetailProps { } const ContainerMain = styled.div` background: ${({ theme }) => theme.colors.gradients.bubblegum}; - /* padding: 30px 0; */ + padding: 30px 0; ` const MainDiv = styled.div` width: 100%; From 153760dc2c2f63bcbd0eaf6e863a637bde7c8010 Mon Sep 17 00:00:00 2001 From: myf <> Date: Tue, 3 May 2022 21:20:28 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=A4=96=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 3 +- src/components/Menu/index.tsx | 27 ++++++++++++++++-- src/state/actions.ts | 2 +- src/state/types.ts | 3 +- src/state/userInfo/hooks.ts | 3 ++ src/state/userInfo/index.ts | 20 +++++++++++-- src/types/user.ts | 21 ++++++++++++++ src/views/Home/components/FristCom.tsx | 30 +++++++++++--------- src/views/Referral/components/Connected.tsx | 4 +-- src/views/Referral/components/Regimental.tsx | 6 ++-- 10 files changed, 92 insertions(+), 27 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 39dd9e3..f4d632b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,7 @@ import { usePollCoreFarmData, useFetchProfile, usePollBlockNumber } from 'state/ import { DatePickerPortal } from 'components/DatePicker' import { initAxios } from 'utils/request' import useToast from 'hooks/useToast' -import { fetchUserInfo, clearUserInfo } from 'state/actions' +import { fetchUserInfo, clearUserInfo, fetchOutInfo } from 'state/actions' import { useAccount } from 'state/userInfo/hooks' import GlobalStyle from './style/Global' import Menu from './components/Menu' @@ -70,6 +70,7 @@ const App: React.FC = () => { const account = useAccount() useEffect(() => { + // dispatch(fetchOutInfo()) initAxios(() => { dispatch(clearUserInfo) }, toast) diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 382a6d5..7e62c3e 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -1,18 +1,24 @@ import React, { useEffect, useState, useMemo } from 'react' import { Menu as UikitMenu, ConnectorNames } from '@pancakeswap/uikit' +import { useDispatch } from 'react-redux' import { useWeb3React } from '@web3-react/core' import { languageList } from 'config/localization/languages' import { useTranslation } from 'contexts/Localization' import useTheme from 'hooks/useTheme' import useAuth from 'hooks/useAuth' -import { useDispatch } from 'react-redux' import { usePriceHccUsdt, useProfile } from 'state/hooks' -import { useUnactiveAccount, useSignLogin, useAccount, useUserInfo } from 'state/userInfo/hooks' +import { useUnactiveAccount, useSignLogin, useAccount, useUserInfo, useOutLink } from 'state/userInfo/hooks' import useWeb3Provider from 'hooks/useActiveWeb3React' -import { clearUserInfo } from 'state/actions' +import { clearUserInfo, fetchOutInfo } from 'state/actions' +import { uccnDetail } from 'services/user' import config from './config' const Menu = (props) => { + // const [detail, setDetail] = useState({ userNumb: 0, tradingVolume: 0, outsideChainVos: [] }) + // const getDetail = async () => { + // const data = await uccnDetail() + // setDetail(data) + // } const account = useAccount() const { login, logout } = useAuth() const [hasWalletLogin, setHasWalletLogin] = useState(false) @@ -23,6 +29,8 @@ const Menu = (props) => { const dispatch = useDispatch() const { profile } = useProfile() const userInfo = useUserInfo() + // const detail = useOutLink() + // console.log(userInfo) const { currentLanguage, setLanguage, t } = useTranslation() const inviteUrl = useMemo(() => { return userInfo?.inviteCode ? `${window.location.origin}?inviteCode=${userInfo.inviteCode}` : window.location.origin @@ -43,6 +51,18 @@ const Menu = (props) => { sign() } }, [unActiveAccount, hasWalletLogin, library]) + // dispatch(fetchOutInfo()) + // const detail = useOutLink() + // console.log('detail123456:', detail.outsideChainVos) + useEffect(() => { + // dispatch(fetchOutInfo()) + // getDetail() + // const detail = useOutLink() + dispatch(fetchOutInfo()) + }, []) + const detail = useOutLink() + console.log(config(t)) + return ( { setLang={setLanguage} cakePriceUsd={hccPriceUsdt.toNumber()} links={config(t)} + outLink={detail.outsideChainVos} {...props} /> ) diff --git a/src/state/actions.ts b/src/state/actions.ts index 0bc2d26..08e9209 100644 --- a/src/state/actions.ts +++ b/src/state/actions.ts @@ -10,7 +10,7 @@ export { updateUserPendingReward, updateUserStakedBalance, } from './pools' -export { setUserInfo, clearUserInfo, fetchUserInfo } from './userInfo' +export { setUserInfo, clearUserInfo, fetchUserInfo, fetchOutInfo } from './userInfo' export { fetchReferralInfoAsync } from './referral' export { fetchBoardsPublicDataAsync, fetchBoardUserDataAsync } from './boards' export { profileFetchStart, profileFetchSucceeded, profileFetchFailed } from './profile' diff --git a/src/state/types.ts b/src/state/types.ts index 33f7875..60075db 100644 --- a/src/state/types.ts +++ b/src/state/types.ts @@ -12,7 +12,7 @@ import { Team, BoardConfig, } from 'config/constants/types' -import { UserInfo } from 'types/user' +import { UserInfo, OutLink } from 'types/user' import { ReferralConfigInfo, ReferralRewardInfo } from 'types/referral' export type AppThunk = ThunkAction @@ -481,6 +481,7 @@ export interface UserInfoState { userInfo: UserInfo token?: string account?: string + outLink?: OutLink } export interface ReferralState { diff --git a/src/state/userInfo/hooks.ts b/src/state/userInfo/hooks.ts index 6c9b8e3..2d8c2d7 100644 --- a/src/state/userInfo/hooks.ts +++ b/src/state/userInfo/hooks.ts @@ -29,6 +29,9 @@ export const useToken = () => { export const useUserInfo = () => { return useSelector((state: State) => state.userInfo.userInfo) } +export const useOutLink = () => { + return useSelector((state: State) => state.userInfo.outLink) +} // 签名登录 export const useSignLogin = () => { diff --git a/src/state/userInfo/index.ts b/src/state/userInfo/index.ts index 4316580..2481025 100644 --- a/src/state/userInfo/index.ts +++ b/src/state/userInfo/index.ts @@ -1,11 +1,12 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit' -import { queryUserInfo } from 'services/user' +import { queryUserInfo, uccnDetail } from 'services/user' import { CACHE_TOKEN, CACHE_ACCOUNT, CACHE_USERINFO } from 'config/constants/cacheKey' -import { UserInfo } from 'types/user' +import { UserInfo, OutLink } from 'types/user' import { UserInfoState } from '../types' const initialState: UserInfoState = { userInfo: {}, + outLink: {}, token: localStorage.getItem(CACHE_TOKEN), account: localStorage.getItem(CACHE_ACCOUNT), } @@ -15,6 +16,11 @@ export const fetchUserInfo = createAsyncThunk('userInfo/fetchUse return result }) +export const fetchOutInfo = createAsyncThunk('uccn/detail', async () => { + const result = await uccnDetail() + return result +}) + export const userInfoSlice = createSlice({ name: 'userInfo', initialState, @@ -22,6 +28,7 @@ export const userInfoSlice = createSlice({ setUserInfo: (state, action) => { const info = action.payload state.userInfo = info + state.outLink = info.outLink state.account = info.address info.token && (state.token = info.token) localStorage.setItem(CACHE_TOKEN, state.token) @@ -36,15 +43,22 @@ export const userInfoSlice = createSlice({ localStorage.removeItem(CACHE_USERINFO) localStorage.removeItem(CACHE_ACCOUNT) }, + setOutLinkInfo: (state, action) => { + state.outLink = action.payload.outLink + }, }, extraReducers: (builder) => { builder.addCase(fetchUserInfo.fulfilled, (state, action) => { state.userInfo = action.payload localStorage.setItem(CACHE_USERINFO, JSON.stringify(state.userInfo)) }) + builder.addCase(fetchOutInfo.fulfilled, (state, action) => { + localStorage.setItem('cs', 'cs') + state.outLink = action.payload + }) }, }) // Actions -export const { setUserInfo, clearUserInfo } = userInfoSlice.actions +export const { setUserInfo, clearUserInfo, setOutLinkInfo } = userInfoSlice.actions export default userInfoSlice.reducer diff --git a/src/types/user.ts b/src/types/user.ts index 85fdf91..097cccf 100644 --- a/src/types/user.ts +++ b/src/types/user.ts @@ -4,3 +4,24 @@ export interface UserInfo { name?: string address?: string } + +export interface OutLink { + outSideChainNumb?: string + outsideChainVos?: OUtLinkList[] + telegramNumb?: string + tradingVolume?: string + userNumb?: string +} + +export interface OUtLinkList { + content?: string + cover?: string + createdAt?: string + enabled?: boolean + englishName?: string + id?: string + link?: string + name?: string + orderNumber?: string + updatedAt?: string +} diff --git a/src/views/Home/components/FristCom.tsx b/src/views/Home/components/FristCom.tsx index e4a2ff5..41e4b39 100644 --- a/src/views/Home/components/FristCom.tsx +++ b/src/views/Home/components/FristCom.tsx @@ -1,8 +1,12 @@ import React, { useState, useEffect } from 'react' import styled from 'styled-components' +import { useDispatch } from 'react-redux' +import { useOutLink } from 'state/userInfo/hooks' +import { fetchOutInfo } from 'state/actions' import { uccnDetail } from 'services/user' import { Flex, Heading, Text, Box, Button, Image, Link } from '@pancakeswap/uikit' import { useTranslation } from 'contexts/Localization' +import { OutLink } from 'types/user' import FlexItemCom from './FlexItemCom' @@ -128,23 +132,22 @@ const ScoreDiv = styled(Flex)` } ` const InfoDiv = styled.div`` - const FristCom: React.FC = () => { const { t } = useTranslation() + const dispatch = useDispatch() // const [burned, BurnedState] = useState([ // { id: 'userNumb', name: '持有人数量', value: '0' }, // { id: 'tradingVolume', name: '交易量', value: '0' }, // { id: 3, name: '市值', value: '62.55%' }, // ]) - const [detail, setDetail] = useState({ userNumb: 0, tradingVolume: 0, outsideChainVos: [] }) - const getDetail = async () => { - const data = await uccnDetail() - setDetail(data) - } - - useEffect(() => { - getDetail() - }, []) + // const [detail, setDetail] = useState({ userNumb: 0, tradingVolume: 0, outsideChainVos: [] }) + // const getDetail = async () => { + // const data = await uccnDetail() + // setDetail(data) + // } + dispatch(fetchOutInfo()) + const detail = useOutLink() + console.log('detail123:', detail) const openLink = (link) => { window.open(link) } @@ -167,9 +170,10 @@ const FristCom: React.FC = () => { {/* {t('Bazaar')} */} - {detail.outsideChainVos.map((item) => { + {detail.outsideChainVos?.map((item) => { return ( { - - + + {/* {burned.map((item) => { return diff --git a/src/views/Referral/components/Connected.tsx b/src/views/Referral/components/Connected.tsx index 2f3b57f..15e950d 100644 --- a/src/views/Referral/components/Connected.tsx +++ b/src/views/Referral/components/Connected.tsx @@ -86,8 +86,8 @@ const ConnectedCom: React.FC = () => { /> - {referralNormalConfigInfo.receiveLimit <= - referralRewardInfo.inviteReward - referralRewardInfo.inviteRewardReceive ? ( + {referralNormalConfigInfo?.receiveLimit <= + referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive ? ( {t('Claim now')} diff --git a/src/views/Referral/components/Regimental.tsx b/src/views/Referral/components/Regimental.tsx index 6c6d9c5..51f3192 100644 --- a/src/views/Referral/components/Regimental.tsx +++ b/src/views/Referral/components/Regimental.tsx @@ -144,8 +144,8 @@ const RegimentalCom: React.FC = () => { - {referralCommanderConfigInfo.receiveLimit <= - referralRewardInfo.inviteReward - referralRewardInfo.inviteRewardReceive ? ( + {referralCommanderConfigInfo?.receiveLimit <= + referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive ? ( {t('Claim now')} @@ -158,7 +158,7 @@ const RegimentalCom: React.FC = () => { {`${t( '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')}`} + )}${formatDivNumber(referralCommanderConfigInfo?.dividendFirst)}%${t('The commission')}`} {/* {t('each time')} {t('last bid')} {t('commission fee')} */} From dd5c62b05e2b369a26f2eb4d0b726964c7cad11f Mon Sep 17 00:00:00 2001 From: myf <> Date: Thu, 5 May 2022 10:58:43 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E9=A6=96=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 3 +-- src/components/Menu/index.tsx | 34 +++++++++++++------------- src/services/user.ts | 7 ++++++ src/state/actions.ts | 2 +- src/state/types.ts | 5 ++++ src/state/userInfo/hooks.ts | 3 --- src/state/userInfo/index.ts | 20 +++------------ src/types/user.ts | 24 +++++++++--------- src/views/Home/components/FristCom.tsx | 33 ++++++++++++------------- 9 files changed, 63 insertions(+), 68 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index f4d632b..39dd9e3 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -8,7 +8,7 @@ import { usePollCoreFarmData, useFetchProfile, usePollBlockNumber } from 'state/ import { DatePickerPortal } from 'components/DatePicker' import { initAxios } from 'utils/request' import useToast from 'hooks/useToast' -import { fetchUserInfo, clearUserInfo, fetchOutInfo } from 'state/actions' +import { fetchUserInfo, clearUserInfo } from 'state/actions' import { useAccount } from 'state/userInfo/hooks' import GlobalStyle from './style/Global' import Menu from './components/Menu' @@ -70,7 +70,6 @@ const App: React.FC = () => { const account = useAccount() useEffect(() => { - // dispatch(fetchOutInfo()) initAxios(() => { dispatch(clearUserInfo) }, toast) diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 7e62c3e..3b96828 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -7,18 +7,13 @@ import { useTranslation } from 'contexts/Localization' import useTheme from 'hooks/useTheme' import useAuth from 'hooks/useAuth' import { usePriceHccUsdt, useProfile } from 'state/hooks' -import { useUnactiveAccount, useSignLogin, useAccount, useUserInfo, useOutLink } from 'state/userInfo/hooks' +import { useUnactiveAccount, useSignLogin, useAccount, useUserInfo } from 'state/userInfo/hooks' import useWeb3Provider from 'hooks/useActiveWeb3React' -import { clearUserInfo, fetchOutInfo } from 'state/actions' +import { clearUserInfo } from 'state/actions' import { uccnDetail } from 'services/user' import config from './config' const Menu = (props) => { - // const [detail, setDetail] = useState({ userNumb: 0, tradingVolume: 0, outsideChainVos: [] }) - // const getDetail = async () => { - // const data = await uccnDetail() - // setDetail(data) - // } const account = useAccount() const { login, logout } = useAuth() const [hasWalletLogin, setHasWalletLogin] = useState(false) @@ -51,17 +46,22 @@ const Menu = (props) => { sign() } }, [unActiveAccount, hasWalletLogin, library]) - // dispatch(fetchOutInfo()) - // const detail = useOutLink() - // console.log('detail123456:', detail.outsideChainVos) + + const [detail, setDetail] = useState({ + outSideChainNumb: '', + outsideChainVos: [], + telegramNumb: '', + tradingVolume: '', + userNumb: '', + }) + const getDetail = async () => { + const result = await uccnDetail() + const { data } = result.data + setDetail(data) + } useEffect(() => { - // dispatch(fetchOutInfo()) - // getDetail() - // const detail = useOutLink() - dispatch(fetchOutInfo()) + getDetail() }, []) - const detail = useOutLink() - console.log(config(t)) return ( { setLang={setLanguage} cakePriceUsd={hccPriceUsdt.toNumber()} links={config(t)} - outLink={detail.outsideChainVos} + outLink={detail?.outsideChainVos} {...props} /> ) diff --git a/src/services/user.ts b/src/services/user.ts index 90ce248..5146557 100644 --- a/src/services/user.ts +++ b/src/services/user.ts @@ -12,4 +12,11 @@ export const uccnDetail = () => { method: 'get', }) } +export const indexInfo = () => { + return request.request({ + url: '/high_city/app/api/index/info', + method: 'get', + }) +} + export default queryUserInfo diff --git a/src/state/actions.ts b/src/state/actions.ts index 08e9209..0bc2d26 100644 --- a/src/state/actions.ts +++ b/src/state/actions.ts @@ -10,7 +10,7 @@ export { updateUserPendingReward, updateUserStakedBalance, } from './pools' -export { setUserInfo, clearUserInfo, fetchUserInfo, fetchOutInfo } from './userInfo' +export { setUserInfo, clearUserInfo, fetchUserInfo } from './userInfo' export { fetchReferralInfoAsync } from './referral' export { fetchBoardsPublicDataAsync, fetchBoardUserDataAsync } from './boards' export { profileFetchStart, profileFetchSucceeded, profileFetchFailed } from './profile' diff --git a/src/state/types.ts b/src/state/types.ts index 60075db..efefbc2 100644 --- a/src/state/types.ts +++ b/src/state/types.ts @@ -484,6 +484,10 @@ export interface UserInfoState { outLink?: OutLink } +export interface OutLinkState { + home: OutLink +} + export interface ReferralState { commanderConfigInfo: ReferralConfigInfo normalConfigInfo: ReferralConfigInfo @@ -520,4 +524,5 @@ export interface State { referral: ReferralState boards: BoardsState lottery: LotteryState + home?: OutLink } diff --git a/src/state/userInfo/hooks.ts b/src/state/userInfo/hooks.ts index 2d8c2d7..6c9b8e3 100644 --- a/src/state/userInfo/hooks.ts +++ b/src/state/userInfo/hooks.ts @@ -29,9 +29,6 @@ export const useToken = () => { export const useUserInfo = () => { return useSelector((state: State) => state.userInfo.userInfo) } -export const useOutLink = () => { - return useSelector((state: State) => state.userInfo.outLink) -} // 签名登录 export const useSignLogin = () => { diff --git a/src/state/userInfo/index.ts b/src/state/userInfo/index.ts index 2481025..4316580 100644 --- a/src/state/userInfo/index.ts +++ b/src/state/userInfo/index.ts @@ -1,12 +1,11 @@ import { createAsyncThunk, createSlice } from '@reduxjs/toolkit' -import { queryUserInfo, uccnDetail } from 'services/user' +import { queryUserInfo } from 'services/user' import { CACHE_TOKEN, CACHE_ACCOUNT, CACHE_USERINFO } from 'config/constants/cacheKey' -import { UserInfo, OutLink } from 'types/user' +import { UserInfo } from 'types/user' import { UserInfoState } from '../types' const initialState: UserInfoState = { userInfo: {}, - outLink: {}, token: localStorage.getItem(CACHE_TOKEN), account: localStorage.getItem(CACHE_ACCOUNT), } @@ -16,11 +15,6 @@ export const fetchUserInfo = createAsyncThunk('userInfo/fetchUse return result }) -export const fetchOutInfo = createAsyncThunk('uccn/detail', async () => { - const result = await uccnDetail() - return result -}) - export const userInfoSlice = createSlice({ name: 'userInfo', initialState, @@ -28,7 +22,6 @@ export const userInfoSlice = createSlice({ setUserInfo: (state, action) => { const info = action.payload state.userInfo = info - state.outLink = info.outLink state.account = info.address info.token && (state.token = info.token) localStorage.setItem(CACHE_TOKEN, state.token) @@ -43,22 +36,15 @@ export const userInfoSlice = createSlice({ localStorage.removeItem(CACHE_USERINFO) localStorage.removeItem(CACHE_ACCOUNT) }, - setOutLinkInfo: (state, action) => { - state.outLink = action.payload.outLink - }, }, extraReducers: (builder) => { builder.addCase(fetchUserInfo.fulfilled, (state, action) => { state.userInfo = action.payload localStorage.setItem(CACHE_USERINFO, JSON.stringify(state.userInfo)) }) - builder.addCase(fetchOutInfo.fulfilled, (state, action) => { - localStorage.setItem('cs', 'cs') - state.outLink = action.payload - }) }, }) // Actions -export const { setUserInfo, clearUserInfo, setOutLinkInfo } = userInfoSlice.actions +export const { setUserInfo, clearUserInfo } = userInfoSlice.actions export default userInfoSlice.reducer diff --git a/src/types/user.ts b/src/types/user.ts index 097cccf..5b633f8 100644 --- a/src/types/user.ts +++ b/src/types/user.ts @@ -6,22 +6,24 @@ export interface UserInfo { } export interface OutLink { - outSideChainNumb?: string - outsideChainVos?: OUtLinkList[] - telegramNumb?: string - tradingVolume?: string - userNumb?: string + externalLinkList?: OutLinkList[] + userCount?: string + volume?: string } -export interface OUtLinkList { - content?: string - cover?: string +export interface OutLinkList { createdAt?: string enabled?: boolean - englishName?: string + iconResource?: IconResource id?: string - link?: string + englishName?: string + linkMap?: any name?: string - orderNumber?: string + orderNum?: string + remark?: string updatedAt?: string } +export interface IconResource { + path: string + url: string +} diff --git a/src/views/Home/components/FristCom.tsx b/src/views/Home/components/FristCom.tsx index 41e4b39..2437c2f 100644 --- a/src/views/Home/components/FristCom.tsx +++ b/src/views/Home/components/FristCom.tsx @@ -1,9 +1,7 @@ import React, { useState, useEffect } from 'react' import styled from 'styled-components' import { useDispatch } from 'react-redux' -import { useOutLink } from 'state/userInfo/hooks' -import { fetchOutInfo } from 'state/actions' -import { uccnDetail } from 'services/user' +import { uccnDetail, indexInfo } from 'services/user' import { Flex, Heading, Text, Box, Button, Image, Link } from '@pancakeswap/uikit' import { useTranslation } from 'contexts/Localization' import { OutLink } from 'types/user' @@ -135,19 +133,20 @@ const InfoDiv = styled.div`` const FristCom: React.FC = () => { const { t } = useTranslation() const dispatch = useDispatch() - // const [burned, BurnedState] = useState([ - // { id: 'userNumb', name: '持有人数量', value: '0' }, - // { id: 'tradingVolume', name: '交易量', value: '0' }, - // { id: 3, name: '市值', value: '62.55%' }, - // ]) - // const [detail, setDetail] = useState({ userNumb: 0, tradingVolume: 0, outsideChainVos: [] }) - // const getDetail = async () => { - // const data = await uccnDetail() - // setDetail(data) - // } - dispatch(fetchOutInfo()) - const detail = useOutLink() - console.log('detail123:', detail) + const [detail, setDetail] = useState({ + outSideChainNumb: '', + outsideChainVos: [], + telegramNumb: '', + tradingVolume: '', + userNumb: '', + }) + const getDetail = async () => { + const data = await uccnDetail() + setDetail(data) + } + useEffect(() => { + getDetail() + }, []) const openLink = (link) => { window.open(link) } @@ -170,7 +169,7 @@ const FristCom: React.FC = () => { {/* {t('Bazaar')} */} - {detail.outsideChainVos?.map((item) => { + {detail?.outsideChainVos?.map((item) => { return ( Date: Thu, 5 May 2022 20:54:53 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E5=A4=96=E9=93=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 +- src/App.tsx | 1 + src/components/Menu/index.tsx | 34 +++++++++++++----------- src/views/Home/components/FristCom.tsx | 36 ++++++++++++++++---------- 4 files changed, 44 insertions(+), 29 deletions(-) diff --git a/.env.development b/.env.development index ba50e11..9f188d7 100644 --- a/.env.development +++ b/.env.development @@ -20,4 +20,4 @@ REACT_APP_SNAPSHOT_VOTING_API = "https://xtjyd0liqe.execute-api.ap-northeast-1.a REACT_APP_REQUEST_URL = 'http://101.35.117.69:9090' -# REACT_APP_REQUEST_URL = 'http://192.168.2.210:8080' +# REACT_APP_REQUEST_URL = 'http://192.168.2.28:8080' diff --git a/src/App.tsx b/src/App.tsx index 39dd9e3..20c0ddf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -2,6 +2,7 @@ import React, { lazy, useEffect } from 'react' import { Router, Redirect, Route, Switch } from 'react-router-dom' import { ResetCSS } from '@pancakeswap/uikit' import { useDispatch } from 'react-redux' +import { uccnDetail, indexInfo } from 'services/user' import BigNumber from 'bignumber.js' import useEagerConnect from 'hooks/useEagerConnect' import { usePollCoreFarmData, useFetchProfile, usePollBlockNumber } from 'state/hooks' diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 3b96828..3cc7886 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState, useMemo } from 'react' import { Menu as UikitMenu, ConnectorNames } from '@pancakeswap/uikit' import { useDispatch } from 'react-redux' +import { uccnDetail, indexInfo } from 'services/user' import { useWeb3React } from '@web3-react/core' import { languageList } from 'config/localization/languages' import { useTranslation } from 'contexts/Localization' @@ -10,10 +11,11 @@ import { usePriceHccUsdt, useProfile } from 'state/hooks' import { useUnactiveAccount, useSignLogin, useAccount, useUserInfo } from 'state/userInfo/hooks' import useWeb3Provider from 'hooks/useActiveWeb3React' import { clearUserInfo } from 'state/actions' -import { uccnDetail } from 'services/user' import config from './config' +const list = [] const Menu = (props) => { + console.log(props) const account = useAccount() const { login, logout } = useAuth() const [hasWalletLogin, setHasWalletLogin] = useState(false) @@ -39,6 +41,20 @@ const Menu = (props) => { dispatch(clearUserInfo()) logout() } + + const [linkList, setLinkList] = useState([]) + const getDetails = async () => { + const result = await indexInfo() + const { data } = result.data + data.externalLinkList.forEach((item) => { + const links = [] + Object.keys(item.linkMap).forEach((key) => { + links.push({ name: key, link: item.linkMap[key], icon: item.iconResource.url }) + }) + list.push({ icon: item.iconResource.url, list: links }) + }) + setLinkList(list) + } // 钱包登录后 useEffect(() => { if (unActiveAccount && library.provider && hasWalletLogin) { @@ -47,20 +63,8 @@ const Menu = (props) => { } }, [unActiveAccount, hasWalletLogin, library]) - const [detail, setDetail] = useState({ - outSideChainNumb: '', - outsideChainVos: [], - telegramNumb: '', - tradingVolume: '', - userNumb: '', - }) - const getDetail = async () => { - const result = await uccnDetail() - const { data } = result.data - setDetail(data) - } useEffect(() => { - getDetail() + getDetails() }, []) return ( @@ -76,7 +80,7 @@ const Menu = (props) => { setLang={setLanguage} cakePriceUsd={hccPriceUsdt.toNumber()} links={config(t)} - outLink={detail?.outsideChainVos} + outLink={linkList} {...props} /> ) diff --git a/src/views/Home/components/FristCom.tsx b/src/views/Home/components/FristCom.tsx index 2437c2f..73119ab 100644 --- a/src/views/Home/components/FristCom.tsx +++ b/src/views/Home/components/FristCom.tsx @@ -134,21 +134,32 @@ const FristCom: React.FC = () => { const { t } = useTranslation() const dispatch = useDispatch() const [detail, setDetail] = useState({ - outSideChainNumb: '', - outsideChainVos: [], - telegramNumb: '', - tradingVolume: '', - userNumb: '', + externalLinkList: [], + userCount: '', + volume: '', }) + const [linkList, setLinkList] = useState([]) + const getDetail = async () => { - const data = await uccnDetail() + const data = await indexInfo() + const list = [] + data.externalLinkList.forEach((item) => { + const links = [] + Object.keys(item.linkMap).forEach((key) => { + links.push({ name: key, link: item.linkMap[key], icon: item.iconResource.url }) + }) + list.push({ icon: item.iconResource.url, list: links }) + }) + setLinkList(list) setDetail(data) } useEffect(() => { getDetail() }, []) const openLink = (link) => { - window.open(link) + console.log('link:', link) + // window.open(link) + window.location.href = link } return ( <> @@ -169,16 +180,15 @@ const FristCom: React.FC = () => { {/* {t('Bazaar')} */} - {detail?.outsideChainVos?.map((item) => { + {linkList?.map((item) => { return ( openLink(item.link)} + onClick={() => openLink(item.list[0].link)} /> ) })} @@ -189,8 +199,8 @@ const FristCom: React.FC = () => { - - + + {/* {burned.map((item) => { return From c85534bb8f087695ed4c70fefe148dadf814885a Mon Sep 17 00:00:00 2001 From: myf <> Date: Fri, 6 May 2022 17:38:32 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=A4=9A=E5=9B=BD=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.development | 2 + public/locales/zh-CN.json | 5 +- src/components/Menu/config.ts | 34 ++++++------ src/components/Menu/index.tsx | 1 - src/config/localization/languages.ts | 52 +++++++++---------- src/config/localization/translations.json | 5 +- src/utils/request.ts | 2 +- .../Announcement/components/ListItem.tsx | 23 ++++++-- src/views/Announcement/index.tsx | 2 +- .../Board/components/BoardCard/BoardCard.tsx | 2 +- .../BoardCard/CardActionsContainer.tsx | 2 +- .../components/BoardCard/StakeAction.tsx | 2 +- src/views/Board/components/DepositModal.tsx | 2 +- src/views/Home/components/FristCom.tsx | 7 +-- 14 files changed, 83 insertions(+), 58 deletions(-) diff --git a/.env.development b/.env.development index 9f188d7..203f334 100644 --- a/.env.development +++ b/.env.development @@ -20,4 +20,6 @@ REACT_APP_SNAPSHOT_VOTING_API = "https://xtjyd0liqe.execute-api.ap-northeast-1.a REACT_APP_REQUEST_URL = 'http://101.35.117.69:9090' +# REACT_APP_REQUEST_URL = 'http://192.168.2.147:8080' # REACT_APP_REQUEST_URL = 'http://192.168.2.28:8080' +# REACT_APP_REQUEST_URL = 'http://6o7g1fv83e.51xd.pub' diff --git a/public/locales/zh-CN.json b/public/locales/zh-CN.json index 6d71ba7..99af725 100644 --- a/public/locales/zh-CN.json +++ b/public/locales/zh-CN.json @@ -1122,5 +1122,8 @@ "Insufficient Balance": "余额不足", "HCC Currency amount": "HCC币总量", "Lock up time": "锁仓时间", - "possess LP": "持有LP" + "possess LP": "持有LP", + "capital pool": "资金池", + "Unclaimed income": "待领取收益", + "pledge": "质押" } diff --git a/src/components/Menu/config.ts b/src/components/Menu/config.ts index e9ed631..bc1f065 100644 --- a/src/components/Menu/config.ts +++ b/src/components/Menu/config.ts @@ -35,28 +35,28 @@ const config: (t: ContextApi['t']) => MenuEntry[] = (t) => [ icon: 'FarmIcon', href: 'https://pancake.kiemtienonline360.com/#/pool', }, + // { + // label: t('Farms'), + // icon: 'FarmIcon', + // href: '/farms', + // }, + // { + // label: t('Pools'), + // icon: 'PoolIcon', + // href: '/pools', + // }, { - label: t('Farms'), - icon: 'FarmIcon', - href: '/farms', - }, - { - label: t('Pools'), - icon: 'PoolIcon', - href: '/pools', - }, - { - label: t('Referral'), + label: t('recommend'), icon: 'PoolIcon', href: '/referral', }, + // { + // label: 'NFT', + // icon: 'TicketIcon', + // href: '/nft', + // }, { - label: 'NFT', - icon: 'TicketIcon', - href: '/nft', - }, - { - label: t('Board'), + label: t('capital pool'), icon: 'TicketIcon', href: '/board', }, diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 3cc7886..91091e0 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -66,7 +66,6 @@ const Menu = (props) => { useEffect(() => { getDetails() }, []) - return ( { diff --git a/src/views/Announcement/components/ListItem.tsx b/src/views/Announcement/components/ListItem.tsx index 9f9f1df..9e9e455 100644 --- a/src/views/Announcement/components/ListItem.tsx +++ b/src/views/Announcement/components/ListItem.tsx @@ -6,6 +6,7 @@ interface InfoProps { title?: string content?: string publishTime?: number + top?: boolean } const FlexTable = styled(Flex)` @@ -18,9 +19,10 @@ const FlexTable = styled(Flex)` const TableInfo = styled.div` width: 70%; ` -const TextTitle = styled(Text)` +const FlexTitle = styled(Flex)` font-size: 18px; color: #333333; + align-items: center; ` const TextInfo = styled(Text)` overflow: hidden; @@ -36,13 +38,28 @@ const TextTime = styled(Text)` font-size: 18px; color: #999999; ` +const TextTop = styled(Flex)` + margin-left: 10px; + width: 50px; + height: 25px; + align-items: center; + justify-content: center; + background: #eff4f5; + opacity: 0.75; + border-radius: 15px; + font-size: 12px; + color: #1fc7d4; +` -const ListItem: React.FC = ({ title, content, publishTime }) => { +const ListItem: React.FC = ({ title, content, publishTime, top = false }) => { return ( <> - {title} + + {title} + {top ? 置顶 : ''} + {content} {publishTime} diff --git a/src/views/Announcement/index.tsx b/src/views/Announcement/index.tsx index 6cfe72f..3d6dace 100644 --- a/src/views/Announcement/index.tsx +++ b/src/views/Announcement/index.tsx @@ -186,7 +186,7 @@ const Announcement: React.FC = () => {
{list.map((item) => ( lookDetail(item.id)}> - + ))}
diff --git a/src/views/Board/components/BoardCard/BoardCard.tsx b/src/views/Board/components/BoardCard/BoardCard.tsx index b9e5dc9..4dc8657 100644 --- a/src/views/Board/components/BoardCard/BoardCard.tsx +++ b/src/views/Board/components/BoardCard/BoardCard.tsx @@ -62,7 +62,7 @@ const FCard = styled.div` padding: 24px; position: relative; text-align: center; - min-height: 310px; + min-height: 410px; ` const Divider = styled.div` diff --git a/src/views/Board/components/BoardCard/CardActionsContainer.tsx b/src/views/Board/components/BoardCard/CardActionsContainer.tsx index cf28182..b853961 100644 --- a/src/views/Board/components/BoardCard/CardActionsContainer.tsx +++ b/src/views/Board/components/BoardCard/CardActionsContainer.tsx @@ -59,7 +59,7 @@ const CardActions: React.FC = ({ board, account }) => { - {t('TotalProfit')} + {t('Unclaimed income')} diff --git a/src/views/Board/components/BoardCard/StakeAction.tsx b/src/views/Board/components/BoardCard/StakeAction.tsx index ecd15a5..cf704b4 100644 --- a/src/views/Board/components/BoardCard/StakeAction.tsx +++ b/src/views/Board/components/BoardCard/StakeAction.tsx @@ -59,7 +59,7 @@ const StakeAction: React.FC = ({ stakedBalance, tokenBalan } const renderStakingButtons = () => { return rawStakedBalance === 0 ? ( - + ) : ( {userData.stakedBalance > 0 ? ( diff --git a/src/views/Board/components/DepositModal.tsx b/src/views/Board/components/DepositModal.tsx index 60c47b1..cb9c22b 100644 --- a/src/views/Board/components/DepositModal.tsx +++ b/src/views/Board/components/DepositModal.tsx @@ -45,7 +45,7 @@ const DepositModal: React.FC = ({ }, [fullBalance, setVal]) return ( - + { Object.keys(item.linkMap).forEach((key) => { links.push({ name: key, link: item.linkMap[key], icon: item.iconResource.url }) }) - list.push({ icon: item.iconResource.url, list: links }) + list.push({ icon: item.iconResource.url, name: item.name, list: links }) }) setLinkList(list) setDetail(data) @@ -158,8 +158,8 @@ const FristCom: React.FC = () => { }, []) const openLink = (link) => { console.log('link:', link) - // window.open(link) - window.location.href = link + window.open(link) + // window.location.href = link } return ( <> @@ -185,6 +185,7 @@ const FristCom: React.FC = () => { Date: Sat, 7 May 2022 11:00:49 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Menu/index.tsx | 19 +- src/config/abi/boardPool.json | 198 -------------------- src/config/abi/holderPool.json | 182 ------------------ src/config/constants/boards.ts | 4 - src/config/constants/types.ts | 2 - src/state/boards/fetchBoardsUser.ts | 2 - src/state/boards/index.ts | 1 - src/views/Announcement/index.tsx | 9 +- src/views/Board/index.tsx | 45 +---- src/views/Home/components/FristCom.tsx | 22 +-- src/views/Referral/components/Connected.tsx | 2 - 11 files changed, 20 insertions(+), 466 deletions(-) delete mode 100644 src/config/abi/boardPool.json delete mode 100644 src/config/abi/holderPool.json diff --git a/src/components/Menu/index.tsx b/src/components/Menu/index.tsx index 91091e0..daf32a4 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -13,9 +13,7 @@ import useWeb3Provider from 'hooks/useActiveWeb3React' import { clearUserInfo } from 'state/actions' import config from './config' -const list = [] const Menu = (props) => { - console.log(props) const account = useAccount() const { login, logout } = useAuth() const [hasWalletLogin, setHasWalletLogin] = useState(false) @@ -26,8 +24,6 @@ const Menu = (props) => { const dispatch = useDispatch() const { profile } = useProfile() const userInfo = useUserInfo() - // const detail = useOutLink() - // console.log(userInfo) const { currentLanguage, setLanguage, t } = useTranslation() const inviteUrl = useMemo(() => { return userInfo?.inviteCode ? `${window.location.origin}?inviteCode=${userInfo.inviteCode}` : window.location.origin @@ -42,18 +38,17 @@ const Menu = (props) => { logout() } - const [linkList, setLinkList] = useState([]) + const [socialLink, setSocialLink] = useState([]) const getDetails = async () => { const result = await indexInfo() const { data } = result.data - data.externalLinkList.forEach((item) => { - const links = [] - Object.keys(item.linkMap).forEach((key) => { - links.push({ name: key, link: item.linkMap[key], icon: item.iconResource.url }) + const list = data.externalLinkList.map((item, index) => { + const links = Object.keys(item.linkMap).map((key) => { + return { name: key, link: item.linkMap[key], icon: item.iconResource.url } }) - list.push({ icon: item.iconResource.url, list: links }) + return { icon: item.iconResource.url, list: links, key: index + item.name } }) - setLinkList(list) + setSocialLink(list) } // 钱包登录后 useEffect(() => { @@ -79,7 +74,7 @@ const Menu = (props) => { setLang={setLanguage} cakePriceUsd={hccPriceUsdt.toNumber()} links={config(t)} - outLink={linkList} + socialLink={socialLink} {...props} /> ) diff --git a/src/config/abi/boardPool.json b/src/config/abi/boardPool.json deleted file mode 100644 index 49938af..0000000 --- a/src/config/abi/boardPool.json +++ /dev/null @@ -1,198 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "contract IERC20", "name": "_HCC", "type": "address" }, - { "internalType": "address", "name": "_HCCBODReawardPool", "type": "address" }, - { "internalType": "uint256", "name": "_minStakeAmount", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "EmergencyWithdraw", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Harvest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "newHCCBODReawardPool", "type": "address" }], - "name": "SetHCCBODReawardPoolEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newLockTime", "type": "uint256" }], - "name": "SetLockTimeEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newMinStakeAmount", "type": "uint256" }], - "name": "SetMinStakeAmontEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [], - "name": "HCC", - "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "HCCBODReawardPool", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "_poolInfo", - "outputs": [ - { "internalType": "uint256", "name": "accHCCPerShare", "type": "uint256" }, - { "internalType": "uint256", "name": "totalAmount", "type": "uint256" }, - { "internalType": "uint256", "name": "num", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], - "name": "_userInfo", - "outputs": [ - { "internalType": "uint256", "name": "total", "type": "uint256" }, - { "internalType": "uint256", "name": "reward", "type": "uint256" }, - { "internalType": "uint256", "name": "lp", "type": "uint256" }, - { "internalType": "uint256", "name": "lockTime", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "_amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "emergencyWithdrawHCC", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "harvest", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "lockTime", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minStakeAmount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], - "name": "pendingHCC", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "_HCCBODReawardPool", "type": "address" }], - "name": "setHCCBODReawardPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "_lockTime", "type": "uint256" }], - "name": "setLockTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "_minStakeAmount", "type": "uint256" }], - "name": "setMinStakeAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "setPause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "updatePool", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "userInfo", - "outputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" }, - { "internalType": "uint256", "name": "unLockTime", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "withdrawHCC", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/src/config/abi/holderPool.json b/src/config/abi/holderPool.json deleted file mode 100644 index bc3215b..0000000 --- a/src/config/abi/holderPool.json +++ /dev/null @@ -1,182 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "contract IERC20", "name": "_HCC", "type": "address" }, - { "internalType": "address", "name": "_HCCStakeReawardPool", "type": "address" }, - { "internalType": "uint256", "name": "_minStakeAmount", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "EmergencyWithdraw", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Harvest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "address", "name": "newHCCStakeReawardPool", "type": "address" }], - "name": "SetHCCStakeReawardPoolEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newLockTime", "type": "uint256" }], - "name": "SetLockTimeEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newMinStakeAmount", "type": "uint256" }], - "name": "SetMinStakeAmontEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [], - "name": "HCC", - "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "HCCStakeReawardPool", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "_poolInfo", - "outputs": [ - { "internalType": "uint256", "name": "accHCCPerShare", "type": "uint256" }, - { "internalType": "uint256", "name": "totalAmount", "type": "uint256" }, - { "internalType": "uint256", "name": "num", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], - "name": "_userInfo", - "outputs": [ - { "internalType": "uint256", "name": "total", "type": "uint256" }, - { "internalType": "uint256", "name": "reward", "type": "uint256" }, - { "internalType": "uint256", "name": "lp", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "_amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "emergencyWithdrawHCC", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "harvest", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "minStakeAmount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_user", "type": "address" }], - "name": "pendingHCC", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "_HCCStakeReawardPool", "type": "address" }], - "name": "setHCCStakeReawardPool", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "_minStakeAmount", "type": "uint256" }], - "name": "setMinStakeAmount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "setPause", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "updatePool", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "userInfo", - "outputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "uint256", "name": "rewardDebt", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "withdrawHCC", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/src/config/constants/boards.ts b/src/config/constants/boards.ts index 3c662de..2213da9 100644 --- a/src/config/constants/boards.ts +++ b/src/config/constants/boards.ts @@ -1,8 +1,6 @@ import addresses from 'config/constants/contracts' import boardAbi from 'config/abi/board.json' -import boardPoolAbi from 'config/abi/boardPool.json' import holderAbi from 'config/abi/holder.json' -import holderPoolAbis from 'config/abi/holderPool.json' import tokens from './tokens' import { BoardConfig } from './types' @@ -17,7 +15,6 @@ const boardsList: BoardConfig[] = [ contractAddress: addresses.boardChef, contractRewardAddress: addresses.boardRewardChef, abi: boardAbi, - poolAbi: boardPoolAbi, }, { pid: 2, @@ -29,7 +26,6 @@ const boardsList: BoardConfig[] = [ contractAddress: addresses.holderChef, contractRewardAddress: addresses.holderRewardChef, abi: holderAbi, - poolAbi: holderPoolAbis, }, ] diff --git a/src/config/constants/types.ts b/src/config/constants/types.ts index 7126189..9c1c89a 100644 --- a/src/config/constants/types.ts +++ b/src/config/constants/types.ts @@ -188,6 +188,4 @@ export interface BoardConfig { contractAddress: Address contractRewardAddress: Address abi: any - poolAbi: any - // rewardAbi: any } diff --git a/src/state/boards/fetchBoardsUser.ts b/src/state/boards/fetchBoardsUser.ts index 85178a5..5979eb5 100644 --- a/src/state/boards/fetchBoardsUser.ts +++ b/src/state/boards/fetchBoardsUser.ts @@ -54,7 +54,6 @@ export const fetchBoardUserInfo = async (account: string) => { }, ] const [userInfo, estimatedProfit] = await multicall(board.abi, calls) - console.log(userInfo) return { stakedBalance: new BigNumber(userInfo.amount._hex).toJSON(), unLockTime: userInfo.unLockTime ? new BigNumber(userInfo.unLockTime._hex).toNumber() : 0, @@ -65,6 +64,5 @@ export const fetchBoardUserInfo = async (account: string) => { } }), ) - console.log('data:', data) return data } diff --git a/src/state/boards/index.ts b/src/state/boards/index.ts index 4f8a894..1bc6486 100644 --- a/src/state/boards/index.ts +++ b/src/state/boards/index.ts @@ -54,7 +54,6 @@ export const fetchBoardUserDataAsync = (account) => async (dispatch) => { rewardDebt: userInfo[index].rewardDebt, } }) - console.log(arrayOfUserDataObjects) dispatch(setBoardsUserData({ arrayOfUserDataObjects })) } diff --git a/src/views/Announcement/index.tsx b/src/views/Announcement/index.tsx index 3d6dace..a7164ad 100644 --- a/src/views/Announcement/index.tsx +++ b/src/views/Announcement/index.tsx @@ -19,7 +19,6 @@ const ContainerMain = styled.div` const MainDiv = styled.div` width: 100%; min-height: calc(100vh - 64px); - /* background: ${({ theme }) => theme.colors.gradients.bubblegum}; */ box-sizing: border-box; ` const TableDiv = styled.div` @@ -136,12 +135,7 @@ const Announcement: React.FC = () => { setList([]) } const data = await getAnnouncementPage({ page, size, title }) - let dataList = [] - if (type) { - dataList = data.content - } else { - dataList = [...list, ...data.content] - } + const dataList = type ? data.content : [...list, ...data.content] setList(dataList) if (data.content.length === 0 || !data.content) { setTotalVisible(true) @@ -195,7 +189,6 @@ const Announcement: React.FC = () => { const handleChange = (evt: React.ChangeEvent) => { const { value: inputValue } = evt.target setSearchTitle(inputValue) - console.log(searchTitle) } return ( diff --git a/src/views/Board/index.tsx b/src/views/Board/index.tsx index 8f505cd..51ac545 100644 --- a/src/views/Board/index.tsx +++ b/src/views/Board/index.tsx @@ -56,22 +56,6 @@ const Boards: React.FC = () => { const [boardNum, setBoardNum] = useState(0) const [holderNum, setHolder] = useState(0) - // // 获取资金池总额 - // const getCapital = async () => { - // const calls = boardsConfig.map((board) => { - // const contractAddress = getAddress(board.contractAddress) - // return { - // address: contractAddress, - // name: '_poolInfo', - // } - // }) - // let total = 0 - // const boardsPoolInfo = await multicall(boardABI, calls) - // boardsPoolInfo.forEach((item) => { - // total += new BigNumber(item.totalAmount._hex).toNumber() - // }) - // setTotalAmount(total) - // } // 获取分红总额 const fetchBoardShares = async () => { const boardsData = await Promise.all( @@ -90,7 +74,7 @@ const Boards: React.FC = () => { }, ]) return { - name: boardConfig.name, + pid: boardConfig.pid, totalAmount: getBalanceAmount(new BigNumber(boardPoolInfo.totalAmount._hex)).toNumber(), num: new BigNumber(boardPoolInfo?.num?._hex).toNumber(), waitWithdrawAmount: getBalanceAmount(new BigNumber(waitWithdrawAmount.balance._hex)).toNumber(), @@ -102,42 +86,19 @@ const Boards: React.FC = () => { boardsData.forEach((item) => { total += item.totalAmount waitWithdrawAmountValue += item.waitWithdrawAmount - if (item.name === 'Board') { + if (item.pid === 1) { setBoardNum(item.num) - } else if (item.name === 'Holder') { + } else if (item.pid === 2) { setHolder(item.waitWithdrawAmount) } }) setTotalAmount(total) setShareOutBonus(waitWithdrawAmountValue) } - // 获取信息 - // const fetchInfo = async () => { - // const boardsData = await Promise.all( - // boardsConfig.map(async (boardConfig) => { - // const [boardUserInfo] = await multicall(boardConfig.poolAbi, [ - // { - // address: getAddress(boardConfig.contractAddress), - // name: 'userInfo', - // params: [account], - // }, - // ]) - // return { - // name: boardConfig.name, - // amount: getBalanceAmount(new BigNumber(boardUserInfo.amount?._hex)).toNumber(), - // rewardDebt: getBalanceAmount(new BigNumber(boardUserInfo.rewardDebt?._hex)).toNumber(), - // unLockTime: new BigNumber(boardUserInfo?.unLockTime?._hex).toNumber(), - // } - // }), - // ) - // setBoardsDataList(boardsData) - // } useEffect(() => { dispatch(fetchBoardsPublicDataAsync()) fetchBoardShares() if (account) { - // fetchInfo() - // const userInfo = fetchBoardUserInfo(account) dispatch(fetchBoardUserDataAsync(account)) } }, [account, dispatch, fastRefresh]) diff --git a/src/views/Home/components/FristCom.tsx b/src/views/Home/components/FristCom.tsx index 871dbe5..ac8703d 100644 --- a/src/views/Home/components/FristCom.tsx +++ b/src/views/Home/components/FristCom.tsx @@ -142,13 +142,11 @@ const FristCom: React.FC = () => { const getDetail = async () => { const data = await indexInfo() - const list = [] - data.externalLinkList.forEach((item) => { - const links = [] - Object.keys(item.linkMap).forEach((key) => { - links.push({ name: key, link: item.linkMap[key], icon: item.iconResource.url }) + const list = data.externalLinkList.map((item, index) => { + const links = Object.keys(item.linkMap).map((key) => { + return { name: key, link: item.linkMap[key], icon: item.iconResource.url } }) - list.push({ icon: item.iconResource.url, name: item.name, list: links }) + return { icon: item.iconResource.url, name: item.name, list: links, key: index + item.name } }) setLinkList(list) setDetail(data) @@ -157,9 +155,7 @@ const FristCom: React.FC = () => { getDetail() }, []) const openLink = (link) => { - console.log('link:', link) window.open(link) - // window.location.href = link } return ( <> @@ -178,11 +174,11 @@ const FristCom: React.FC = () => { openLink('https://pancake.kiemtienonline360.com/#/swap')}> {t('Exchange')} - {/* {t('Bazaar')} */} - {linkList?.map((item) => { - return ( + {linkList?.map((item, index) => { + return index < 6 ? ( { height={34} onClick={() => openLink(item.list[0].link)} /> + ) : ( + '' ) })} - {/* - */}
diff --git a/src/views/Referral/components/Connected.tsx b/src/views/Referral/components/Connected.tsx index 15e950d..0a92932 100644 --- a/src/views/Referral/components/Connected.tsx +++ b/src/views/Referral/components/Connected.tsx @@ -57,9 +57,7 @@ const ConnectedCom: React.FC = () => { const { t } = useTranslation() const [onBuyModal] = useModal() const referralNormalConfigInfo = useReferralNormalConfigInfo() - console.log('referralNormalConfigInfo:', referralNormalConfigInfo) const referralRewardInfo = useReferralRewardInfo() - console.log('referralRewardInfo:', referralRewardInfo) const referralCommanderConfigInfo = useReferralCommanderConfigInfo() const [loading, setLoading] = useState(false) const withdraw = useWithdraw() From 07ad60da7c4f9f25569746bb2c535cfdc2287c0a Mon Sep 17 00:00:00 2001 From: myf <> Date: Sat, 7 May 2022 11:06:54 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/request.ts b/src/utils/request.ts index 6fd443e..3134713 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -4,7 +4,7 @@ import { CACHE_TOKEN } from 'config/constants/cacheKey' // create an axios instance const request = axios.create({ baseURL: process.env.REACT_APP_REQUEST_URL, - timeout: 5000000, // request timeout + timeout: 50000, // request timeout }) let hasInit = false export const initAxios = (clearUserInfo, toast) => {