diff --git a/src/App.tsx b/src/App.tsx index 842648b..e27a0aa 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -49,7 +49,6 @@ const PoolFinder = lazy(() => import('./views/PoolFinder')) const RemoveLiquidity = lazy(() => import('./views/RemoveLiquidity')) const Referral = lazy(() => import('./views/Referral')) const Nft = lazy(() => import('./views/Nft')) -const Recommend = lazy(() => import('./views/Recommend')) // This config is required for number formatting BigNumber.config({ @@ -94,9 +93,6 @@ const App: React.FC = () => { - - - {/* @@ -147,7 +143,6 @@ const App: React.FC = () => { - {/* Redirect */} {/* diff --git a/src/components/Menu/config.ts b/src/components/Menu/config.ts index b188cef..cd902a2 100644 --- a/src/components/Menu/config.ts +++ b/src/components/Menu/config.ts @@ -40,16 +40,11 @@ const config: (t: ContextApi['t']) => MenuEntry[] = (t) => [ icon: 'PoolIcon', href: '/referral', }, - { - label: 'NFT', - icon: 'TicketIcon', - href: '/nft' - }, - { - label: t('recommend'), - icon: 'TicketIcon', - href: '/recommend' - }, + { + label: 'NFT', + icon: 'TicketIcon', + href: '/nft', + }, // { // label: t('Prediction (BETA)'), // icon: 'PredictionsIcon', diff --git a/src/utils/formatBalance.ts b/src/utils/formatBalance.ts index 860fba1..b716356 100644 --- a/src/utils/formatBalance.ts +++ b/src/utils/formatBalance.ts @@ -19,7 +19,7 @@ export const getBalanceAmount = (amount: BigNumber, decimals = 18) => { */ export const getBalanceNumber = (balance: BigNumber, decimals = 18, decimalPlaces?: number) => { const displayBalance = getBalanceAmount(balance, decimals) - return decimalPlaces ?displayBalance.decimalPlaces(decimalPlaces).toNumber():displayBalance.toNumber() + return decimalPlaces ? displayBalance.decimalPlaces(decimalPlaces).toNumber() : displayBalance.toNumber() } export const getFullDisplayBalance = (balance: BigNumber, decimals = 18, displayDecimals?: number) => { diff --git a/src/views/Recommend/index.tsx b/src/views/Recommend/index.tsx deleted file mode 100644 index c833535..0000000 --- a/src/views/Recommend/index.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React, { useState } from 'react' -import styled from 'styled-components' -import UnunitedCom from './components/UnunitedCom' -import ConnectedCom from './components/Connected' -import RegimentalCom from './components/Regimental' - -const MainDiv = styled.div` - min-height: calc(100vh - 64px); - background-image: url('/images/recommend/bg.svg'); - background-size: cover; - background-repeat: no-repeat; - display: flex; - align-items: center; - justify-content: center; -` - -const ContentDiv = styled.div` - width: 60%; - background: rgba(255, 255, 255, 0.39); - box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16); - border-radius: 40px; - - ${({ theme }) => theme.mediaQueries.sm} { - width: 60%; - } - - ${({ theme }) => theme.mediaQueries.lg} { - width: 60%; - } - ${({ theme }) => theme.mediaQueries.xs} { - width: 90%; - } -` - -const Nft: React.FC = () => { - // 邀请false普通邀请 true军团长邀请 - const [type, setType] = useState(false) - // 是否连接钱包 - const [status, setStatus] = useState(true) - - return ( - - {type ? : {status ? : }} - - ) -} -export default Nft diff --git a/src/views/Recommend/components/BuyNftModal.tsx b/src/views/Referral/components/BuyNftModal.tsx similarity index 100% rename from src/views/Recommend/components/BuyNftModal.tsx rename to src/views/Referral/components/BuyNftModal.tsx diff --git a/src/views/Recommend/components/Connected.tsx b/src/views/Referral/components/Connected.tsx similarity index 100% rename from src/views/Recommend/components/Connected.tsx rename to src/views/Referral/components/Connected.tsx diff --git a/src/views/Recommend/components/FlexCom.tsx b/src/views/Referral/components/FlexCom.tsx similarity index 100% rename from src/views/Recommend/components/FlexCom.tsx rename to src/views/Referral/components/FlexCom.tsx diff --git a/src/views/Recommend/components/HeaderMain.tsx b/src/views/Referral/components/HeaderMain.tsx similarity index 100% rename from src/views/Recommend/components/HeaderMain.tsx rename to src/views/Referral/components/HeaderMain.tsx diff --git a/src/views/Recommend/components/Regimental.tsx b/src/views/Referral/components/Regimental.tsx similarity index 100% rename from src/views/Recommend/components/Regimental.tsx rename to src/views/Referral/components/Regimental.tsx diff --git a/src/views/Recommend/components/TextFlex.tsx b/src/views/Referral/components/TextFlex.tsx similarity index 100% rename from src/views/Recommend/components/TextFlex.tsx rename to src/views/Referral/components/TextFlex.tsx diff --git a/src/views/Recommend/components/UnunitedCom.tsx b/src/views/Referral/components/UnunitedCom.tsx similarity index 100% rename from src/views/Recommend/components/UnunitedCom.tsx rename to src/views/Referral/components/UnunitedCom.tsx diff --git a/src/views/Referral/index.tsx b/src/views/Referral/index.tsx index 99dbbda..c833535 100644 --- a/src/views/Referral/index.tsx +++ b/src/views/Referral/index.tsx @@ -1,180 +1,47 @@ -/* eslint-disable react-hooks/exhaustive-deps */ -/* eslint-disable no-unneeded-ternary */ -import React, { useEffect, useCallback, useState, useRef, useMemo } from 'react' -import { Button, Heading, CopyToClipboard, Text, Flex } from '@pancakeswap/uikit' +import React, { useState } from 'react' import styled from 'styled-components' -import { State } from 'state/types' -import { useDispatch, useSelector } from 'react-redux' -import { useWeb3React } from '@web3-react/core' -import { useTranslation } from 'contexts/Localization' -import PageHeader from 'components/PageHeader' -import Page from 'components/Layout/Page' -import { getAddressInviteList } from 'services/referral' -// import { useInviteHarvest } from 'hooks/useHarvest' -import { fetchReferralInfoAsync } from 'state/actions' +import UnunitedCom from './components/UnunitedCom' +import ConnectedCom from './components/Connected' +import RegimentalCom from './components/Regimental' -const Header = styled.div` - padding: 32px 0px; - padding-left: 16px; - padding-right: 16px; - text-align: center; +const MainDiv = styled.div` + min-height: calc(100vh - 64px); + background-image: url('/images/recommend/bg.svg'); + background-size: cover; + background-repeat: no-repeat; + display: flex; + align-items: center; + justify-content: center; +` + +const ContentDiv = styled.div` + width: 60%; + background: rgba(255, 255, 255, 0.39); + box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.16); + border-radius: 40px; ${({ theme }) => theme.mediaQueries.sm} { - padding-left: 24px; - padding-right: 24px; + width: 60%; } -` -const PageContainer = styled(Page)` - max-width: 600px; - margin: 0 auto; -` -const LinkContainer = styled.div` - border: 1px solid rgb(216, 222, 227); - padding: 10px 0px; - line-height: 46px; - display: flex; - text-align: center; - flex-direction: column; - align-items: center; - border-radius: 2px; -` -const AddressContainer = styled.div` - border: 1px solid rgb(216, 222, 227); - margin-top: 20px; - text-align: center; -` -const AddressTitle = styled.div` - border-bottom: 1px solid rgb(216, 222, 227); - color: ${({ theme }) => theme.colors.primary}; - font-size: 18px; - padding: 10px 20px;s - line-height: 28px; - background: rgb(244, 247, 250); - font-weight: 600; -` -const AddressList = styled.div` - font-size: 14px; - padding: 10px; - line-height: 24px; -` -const NoData = styled.div` - color: rgb(153, 153, 153); -` -const RewardContainer = styled.div` - text-align: center; - margin-bottom: 20px; -` -const SecondText = styled(Text)` - white-space: break-spaces; -` -const Farms: React.FC = () => { - const { t } = useTranslation() - const dispatch = useDispatch() - const { account } = useWeb3React() - const [inviteList, setInviteList] = useState([]) - const [loading, setLoading] = useState(false) - const inviteInfo = useSelector((state: State) => state.referral.data) - const inviteAddress = useMemo(() => { - return inviteInfo.InviteCode - ? `${window.location.origin}/#/farms?code=${inviteInfo.InviteCode}` - : window.location.origin - }, [inviteInfo]) - useEffect(() => { - if (account) { - getInviteList() - } else { - setInviteList([]) - } - }, [account]) - // const { onReward } = useInviteHarvest() - const handleWithdraw = async () => { - // setLoading(true) - // try { - // await onReward() - // dispatch(fetchReferralInfoAsync(account)) - // setLoading(false) - // } catch (e) { - // setLoading(false) - // } + ${({ theme }) => theme.mediaQueries.lg} { + width: 60%; } - const getInviteList = async () => { - const data: any = await getAddressInviteList({ address: account }) - setInviteList(data) + ${({ theme }) => theme.mediaQueries.xs} { + width: 90%; } +` + +const Nft: React.FC = () => { + // 邀请false普通邀请 true军团长邀请 + const [type, setType] = useState(false) + // 是否连接钱包 + const [status, setStatus] = useState(true) + return ( - <> - - - - - {t('Referral')} - - - {t('Share referral link and get rewards daily.')} - - - {t('Invite more friends, earn more rewards.')} - - - - {/* */} - - - - {/*
- - {t('Referral')} - - - {t('Share referral link and get rewards daily.')} -
- {t('Invite more friends, earn more rewards.')} -
-
*/} - - - {t('Total Rewards')} - - {inviteInfo.totalReward ? Number(inviteInfo.totalReward).toFixed(5) : '0.00000'} - - - - {t('Unclaimed Rewards')} - - {inviteInfo.canWithdrawReward ? Number(inviteInfo.canWithdrawReward).toFixed(5) : '0.00000'} - - - - - - {inviteAddress} - - {t('Copy Link')} - - - {t('Address')} - - {inviteList.length === 0 ? ( - {t('No Data')} - ) : ( - inviteList.map((item, index) => ( - - {item.Address} - - )) - )} - - - - + + {type ? : {status ? : }} + ) } - -export default Farms +export default Nft