diff --git a/.env.development b/.env.development index ba50e11..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.210:8080' +# 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 1edfa37..99af725 100644 --- a/public/locales/zh-CN.json +++ b/public/locales/zh-CN.json @@ -1119,5 +1119,11 @@ "The commission": "的提成!", "market value": "市值", "Loaded all": "已加载全部", - "Insufficient Balance": "余额不足" + "Insufficient Balance": "余额不足", + "HCC Currency amount": "HCC币总量", + "Lock up time": "锁仓时间", + "possess LP": "持有LP", + "capital pool": "资金池", + "Unclaimed income": "待领取收益", + "pledge": "质押" } diff --git a/src/App.tsx b/src/App.tsx index 326b602..5a28172 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/config.ts b/src/components/Menu/config.ts index 13d99d3..bc1f065 100644 --- a/src/components/Menu/config.ts +++ b/src/components/Menu/config.ts @@ -26,27 +26,37 @@ const config: (t: ContextApi['t']) => MenuEntry[] = (t) => [ // ], // }, { - label: t('Farms'), + label: t('Exchange'), icon: 'FarmIcon', - href: '/farms', + href: 'https://pancake.kiemtienonline360.com/#/swap', }, { - label: t('Pools'), - icon: 'PoolIcon', - href: '/pools', + label: t('Liquidity'), + icon: 'FarmIcon', + href: 'https://pancake.kiemtienonline360.com/#/pool', }, + // { + // 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 382a6d5..daf32a4 100644 --- a/src/components/Menu/index.tsx +++ b/src/components/Menu/index.tsx @@ -1,11 +1,12 @@ 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' 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 useWeb3Provider from 'hooks/useActiveWeb3React' @@ -36,6 +37,19 @@ const Menu = (props) => { dispatch(clearUserInfo()) logout() } + + const [socialLink, setSocialLink] = useState([]) + const getDetails = async () => { + const result = await indexInfo() + const { data } = result.data + 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 } + }) + return { icon: item.iconResource.url, list: links, key: index + item.name } + }) + setSocialLink(list) + } // 钱包登录后 useEffect(() => { if (unActiveAccount && library.provider && hasWalletLogin) { @@ -43,6 +57,10 @@ const Menu = (props) => { sign() } }, [unActiveAccount, hasWalletLogin, library]) + + useEffect(() => { + getDetails() + }, []) return ( { setLang={setLanguage} cakePriceUsd={hccPriceUsdt.toNumber()} links={config(t)} + socialLink={socialLink} {...props} /> ) 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..9c1c89a 100644 --- a/src/config/constants/types.ts +++ b/src/config/constants/types.ts @@ -188,5 +188,4 @@ export interface BoardConfig { contractAddress: Address contractRewardAddress: Address abi: any - // rewardAbi: any } diff --git a/src/config/localization/languages.ts b/src/config/localization/languages.ts index 896a1b4..90078b4 100644 --- a/src/config/localization/languages.ts +++ b/src/config/localization/languages.ts @@ -30,34 +30,34 @@ export const ZHCN: Language = { locale: 'zh-CN', language: '简体中文', code: export const ZHTW: Language = { locale: 'zh-TW', language: '繁體中文', code: 'zh-tw' } export const languages = { - 'ar-SA': AR, - 'bn-BD': BN, + // 'ar-SA': AR, + // 'bn-BD': BN, 'en-US': EN, - 'de-DE': DE, - 'el-GR': EL, - 'es-ES': ESES, - 'fi-FI': FI, - 'fil-PH': FIL, - 'fr-FR': FR, - 'hi-IN': HI, - 'hu-HU': HU, - 'id-ID': ID, - 'it-IT': IT, - 'ja-JP': JA, - 'ko-KR': KO, - 'nl-NL': NL, - 'pl-PL': PL, - 'pt-BR': PTBR, - 'pt-PT': PTPT, - 'ro-RO': RO, - 'ru-RU': RU, - 'sv-SE': SVSE, - 'ta-IN': TA, - 'tr-TR': TR, - 'uk-UA': UK, - 'vi-VN': VI, + // 'de-DE': DE, + // 'el-GR': EL, + // 'es-ES': ESES, + // 'fi-FI': FI, + // 'fil-PH': FIL, + // 'fr-FR': FR, + // 'hi-IN': HI, + // 'hu-HU': HU, + // 'id-ID': ID, + // 'it-IT': IT, + // 'ja-JP': JA, + // 'ko-KR': KO, + // 'nl-NL': NL, + // 'pl-PL': PL, + // 'pt-BR': PTBR, + // 'pt-PT': PTPT, + // 'ro-RO': RO, + // 'ru-RU': RU, + // 'sv-SE': SVSE, + // 'ta-IN': TA, + // 'tr-TR': TR, + // 'uk-UA': UK, + // 'vi-VN': VI, 'zh-CN': ZHCN, - 'zh-TW': ZHTW, + // 'zh-TW': ZHTW, } export const languageList = Object.values(languages) diff --git a/src/config/localization/translations.json b/src/config/localization/translations.json index 54a04f2..c667abc 100644 --- a/src/config/localization/translations.json +++ b/src/config/localization/translations.json @@ -1184,68 +1184,74 @@ "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", + "capital pool": "capital pool", + "Unclaimed income": "Unclaimed income", + "pledge": "pledge" } 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/boards/fetchBoardsUser.ts b/src/state/boards/fetchBoardsUser.ts index 1ea0d89..5979eb5 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) => { @@ -57,9 +58,11 @@ export const fetchBoardUserInfo = async (account: string) => { 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(), } }), ) - return data } diff --git a/src/state/boards/index.ts b/src/state/boards/index.ts index a0e9936..1bc6486 100644 --- a/src/state/boards/index.ts +++ b/src/state/boards/index.ts @@ -49,9 +49,11 @@ 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, } }) - dispatch(setBoardsUserData({ arrayOfUserDataObjects })) } diff --git a/src/state/types.ts b/src/state/types.ts index 33f7875..efefbc2 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,11 @@ export interface UserInfoState { userInfo: UserInfo token?: string account?: string + outLink?: OutLink +} + +export interface OutLinkState { + home: OutLink } export interface ReferralState { @@ -519,4 +524,5 @@ export interface State { referral: ReferralState boards: BoardsState lottery: LotteryState + home?: OutLink } diff --git a/src/types/user.ts b/src/types/user.ts index 85fdf91..5b633f8 100644 --- a/src/types/user.ts +++ b/src/types/user.ts @@ -4,3 +4,26 @@ export interface UserInfo { name?: string address?: string } + +export interface OutLink { + externalLinkList?: OutLinkList[] + userCount?: string + volume?: string +} + +export interface OutLinkList { + createdAt?: string + enabled?: boolean + iconResource?: IconResource + id?: string + englishName?: string + linkMap?: any + name?: string + orderNum?: string + remark?: string + updatedAt?: string +} +export interface IconResource { + path: string + url: string +} 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/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 a0ae578..a7164ad 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,14 +12,13 @@ interface DetailProps { content?: string publishTime?: number } -const ContainerMain = styled(Container)` +const ContainerMain = styled.div` background: ${({ theme }) => theme.colors.gradients.bubblegum}; padding: 30px 0; ` 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` @@ -130,10 +129,13 @@ 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] + const dataList = type ? data.content : [...list, ...data.content] setList(dataList) if (data.content.length === 0 || !data.content) { setTotalVisible(true) @@ -166,7 +168,8 @@ const Announcement: React.FC = () => { } const searchList = () => { setList([]) - getList(1, 10, searchTitle) + setTotalVisible(false) + getList(1, 10, searchTitle, 'search') } const close = () => { setDetailVisible(false) @@ -177,7 +180,7 @@ const Announcement: React.FC = () => {
{list.map((item) => ( lookDetail(item.id)}> - + ))}
@@ -186,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/components/BoardCard/BoardCard.tsx b/src/views/Board/components/BoardCard/BoardCard.tsx index ff2e6ed..4dc8657 100644 --- a/src/views/Board/components/BoardCard/BoardCard.tsx +++ b/src/views/Board/components/BoardCard/BoardCard.tsx @@ -3,12 +3,14 @@ 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' import DetailsSection from './DetailsSection' import CardHeading from './CardHeading' import CardActionsContainer from './CardActionsContainer' +import FlexText from './FlexText' const RainbowLight = keyframes` 0% { @@ -60,6 +62,7 @@ const FCard = styled.div` padding: 24px; position: relative; text-align: center; + min-height: 410px; ` const Divider = styled.div` @@ -85,10 +88,18 @@ const NodeCard: React.FC = ({ board, account }) => { const { t } = useTranslation() const [showExpandableSection, setShowExpandableSection] = useState(false) - return ( +
+ + {board.userData?.name === 'Board' ? ( + + ) : ( + '' + )} + +
{/* = ({ board, account }) => { - {t('TotalProfit')} + {t('Unclaimed income')} diff --git a/src/views/Board/components/BoardCard/FlexText.tsx b/src/views/Board/components/BoardCard/FlexText.tsx new file mode 100644 index 0000000..758e21a --- /dev/null +++ b/src/views/Board/components/BoardCard/FlexText.tsx @@ -0,0 +1,18 @@ +import React from 'react' +import styled from 'styled-components' +import { Flex, Text } from '@pancakeswap/uikit' + +interface FlexProp { + name?: string | number + value?: string | number +} + +const FlexText: React.FC = ({ name, value }) => { + return ( + + {name} + {value} + + ) +} +export default FlexText 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 ( - + { const [totalAmount, setTotalAmount] = useState(0) // 分红总额 const [shareOutBonus, setShareOutBonus] = 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 [boardNum, setBoardNum] = useState(0) + const [holderNum, setHolder] = useState(0) + // 获取分红总额 const fetchBoardShares = async () => { const boardsData = await Promise.all( @@ -85,21 +74,32 @@ const Boards: React.FC = () => { }, ]) return { + 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(), } }), ) - console.log(boardsData) + let total = 0 + let waitWithdrawAmountValue = 0 + boardsData.forEach((item) => { + total += item.totalAmount + waitWithdrawAmountValue += item.waitWithdrawAmount + if (item.pid === 1) { + setBoardNum(item.num) + } else if (item.pid === 2) { + setHolder(item.waitWithdrawAmount) + } + }) + setTotalAmount(total) + setShareOutBonus(waitWithdrawAmountValue) } - useEffect(() => { dispatch(fetchBoardsPublicDataAsync()) fetchBoardShares() if (account) { dispatch(fetchBoardUserDataAsync(account)) - // getCapital() } }, [account, dispatch, fastRefresh]) @@ -125,8 +125,8 @@ const Boards: React.FC = () => { {/* */} - - + + {renderContent()} diff --git a/src/views/Home/components/FristCom.tsx b/src/views/Home/components/FristCom.tsx index 0d2ea98..ac8703d 100644 --- a/src/views/Home/components/FristCom.tsx +++ b/src/views/Home/components/FristCom.tsx @@ -1,8 +1,10 @@ import React, { useState, useEffect } from 'react' import styled from 'styled-components' -import { uccnDetail } from 'services/user' +import { useDispatch } from 'react-redux' +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' import FlexItemCom from './FlexItemCom' @@ -128,20 +130,27 @@ const ScoreDiv = styled(Flex)` } ` const InfoDiv = styled.div`` - const FristCom: React.FC = () => { const { t } = useTranslation() - // 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 dispatch = useDispatch() + const [detail, setDetail] = useState({ + externalLinkList: [], + userCount: '', + volume: '', + }) + const [linkList, setLinkList] = useState([]) + const getDetail = async () => { - const data = await uccnDetail() + const data = await indexInfo() + 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 } + }) + return { icon: item.iconResource.url, name: item.name, list: links, key: index + item.name } + }) + setLinkList(list) setDetail(data) } - useEffect(() => { getDetail() }, []) @@ -162,30 +171,33 @@ const FristCom: React.FC = () => { {t('Hcc Nft')} {t('Hcc BTC')} - {t('Exchange')} - {t('Bazaar')} + openLink('https://pancake.kiemtienonline360.com/#/swap')}> + {t('Exchange')} + - {detail.outsideChainVos.map((item) => { - return ( + {linkList?.map((item, index) => { + return index < 6 ? ( openLink(item.link)} + onClick={() => openLink(item.list[0].link)} /> + ) : ( + '' ) })} - {/* - */} - - + + {/* {burned.map((item) => { return 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 7094040..0a92932 100644 --- a/src/views/Referral/components/Connected.tsx +++ b/src/views/Referral/components/Connected.tsx @@ -1,5 +1,6 @@ import React, { useState } from 'react' import styled from 'styled-components' +import { formatDivNumber } from 'utils/formatBalance' import { useTranslation } from 'contexts/Localization' import useToast from 'hooks/useToast' import { Button, useModal, Text } from '@pancakeswap/uikit' @@ -75,16 +76,16 @@ const ConnectedCom: React.FC = () => { <> - - + + - {referralNormalConfigInfo.receiveLimit <= - referralRewardInfo.inviteReward - referralRewardInfo.inviteRewardReceive ? ( + {referralNormalConfigInfo?.receiveLimit <= + referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive ? ( {t('Claim now')} @@ -97,7 +98,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 783e0b8..51f3192 100644 --- a/src/views/Referral/components/Regimental.tsx +++ b/src/views/Referral/components/Regimental.tsx @@ -1,5 +1,6 @@ import React, { useState } from 'react' import styled from 'styled-components' +import { formatDivNumber } from 'utils/formatBalance' import { useTranslation } from 'contexts/Localization' import { useReferralCommanderConfigInfo, useReferralRewardInfo } from 'state/referral/hooks' import { Text, Image, Button, Heading } from '@pancakeswap/uikit' @@ -105,17 +106,22 @@ const RegimentalCom: React.FC = () => { <> - - + + + - {/* { - {referralCommanderConfigInfo.receiveLimit <= - referralRewardInfo.inviteReward - referralRewardInfo.inviteRewardReceive ? ( + {referralCommanderConfigInfo?.receiveLimit <= + referralRewardInfo?.inviteReward - referralRewardInfo?.inviteRewardReceive ? ( {t('Claim now')} @@ -152,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', - )}${referralCommanderConfigInfo.dividendFirst / 10000}%${t('The commission')}`} + )}${formatDivNumber(referralCommanderConfigInfo?.dividendFirst)}%${t('The commission')}`} {/* {t('each time')} {t('last bid')} {t('commission fee')} */}