diff --git a/src/components/Header/MobileOptions.tsx b/src/components/Header/MobileOptions.tsx index ee019e2d4c..8535799b1d 100644 --- a/src/components/Header/MobileOptions.tsx +++ b/src/components/Header/MobileOptions.tsx @@ -1,3 +1,5 @@ +import { SWPR } from '@swapr/sdk' + import { darken } from 'polished' import { useRef } from 'react' import { useTranslation } from 'react-i18next' @@ -5,12 +7,15 @@ import styled from 'styled-components' import { ReactComponent as Cross } from '../../assets/images/crossIcon.svg' import { ReactComponent as ThreeBars } from '../../assets/images/three-bars.svg' +import { useActiveWeb3React } from '../../hooks' import { useOnClickOutside } from '../../hooks/useOnClickOutside' import { ApplicationModal } from '../../state/application/actions' import { useModalOpen, useToggleMobileMenu } from '../../state/application/hooks' import { ExternalLink } from '../../theme' import Popover from '../Popover' +import { HeaderMobileLink } from './HeaderLink' + const StyledPopover = styled(Popover)` padding: 22px; border: none; @@ -69,6 +74,11 @@ export default function MobileOptions() { const popoverRef = useRef(null) const open = useModalOpen(ApplicationModal.MOBILE) const toggle = useToggleMobileMenu() + const { chainId } = useActiveWeb3React() + + const newSwpr = chainId ? SWPR[chainId] : undefined + + const networkWithoutSWPR = !newSwpr const { t } = useTranslation('common') useOnClickOutside(popoverRef, open ? toggle : undefined) @@ -79,12 +89,13 @@ export default function MobileOptions() { placement="bottom-end" content={ - - - {t('DCA')} - - - + {networkWithoutSWPR && ( + + + {t('rewards')} + + + )} diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index 11d810e39d..a1b2dfa248 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -17,6 +17,7 @@ import { useModalOpen, useToggleShowClaimPopup } from '../../state/application/h import { useDarkModeManager, useUpdateSelectedChartOption } from '../../state/user/hooks' import { ChartOption } from '../../state/user/reducer' import { useTokenBalance } from '../../state/wallet/hooks' +import { ExternalLink } from '../../theme' import { breakpoints } from '../../utils/theme' import ClaimModal from '../Claim/ClaimModal' import { UnsupportedNetworkPopover } from '../NetworkUnsupportedPopover' @@ -196,6 +197,40 @@ const StyledChevron = styled(ChevronUp)<{ open: boolean }>` stroke: ${({ theme }) => theme.orange1}; transform: ${({ open }) => (open ? 'rotate(0deg)' : 'rotate(180deg)')}; ` +const DCAExternalLink = styled(ExternalLink)` + display: none; + ${({ theme }) => theme.mediaWidth.upToMedium` + position: relative; + display: flex; + font-weight: 600; + font-size: 14px; + color: #c9c7db; + margin-right: 18px; + `} +` + +const DCAHeaderLink = styled(HeaderLink)` + margin-right: 18px; +` + +const RewardsHeaderMobileLink = styled(HeaderMobileLink)` + ${({ theme }) => theme.mediaWidth.upToSmall` + display: none; + `}; +` + +const DCABadge = styled.p` + position: absolute; + top: -12px; + right: -34px; + font-size: 10px; + background: #97df5c; + padding: 1px 6px; + border-radius: 16px; + color: black; + line-height: 16px; + font-weight: 600; +` function Header() { const { account, chainId } = useActiveWeb3React() @@ -281,12 +316,10 @@ function Header() { {t('rewards')} {networkWithoutSWPR && } - + {t('DCA')} - - ↗ - - + NEW + {t('vote')} @@ -361,10 +394,14 @@ function Header() { )} {!networkWithoutSWPR && ( - + {t('rewards')} - + )} + + {t('DCA')} + NEW + {t('vote')}