Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
Claim flow styles (#2042)
Browse files Browse the repository at this point in the history
* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.

* Claim modal styles WIP.
  • Loading branch information
fairlighteth authored Jan 3, 2022
1 parent d2060bb commit 956c342
Show file tree
Hide file tree
Showing 10 changed files with 1,388 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"semi": false,
"singleQuote": true,
"printWidth": 120
}
}
Binary file added public/audio/mooooo-send.mp3.asd
Binary file not shown.
1 change: 1 addition & 0 deletions src/custom/assets/cow-swap/cowprotocol.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions src/custom/components/CowProtocolLogo/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import styled from 'styled-components/macro'
import CowProtocolIcon from 'assets/cow-swap/cowprotocol.svg'

export const Icon = styled.span<Props>`
${({ theme }) => theme.cowToken.background};
${({ theme }) => theme.cowToken.boxShadow};
height: ${({ size }) => (size ? `${size}px` : '24px')};
width: ${({ size }) => (size ? `${size}px` : '24px')};
display: inline-block;
margin: 0;
border-radius: ${({ size }) => (size ? `${size}px` : '24px')};
position: relative;
&::after {
content: '';
width: 100%;
height: 100%;
position: absolute;
left: 0;
right: 0;
top: 8%;
bottom: 0;
margin: auto;
background: url(${CowProtocolIcon}) no-repeat center/70%;
}
`

interface Props {
size?: number | undefined
}

export default function CowProtocolLogo({ size }: Props) {
return <Icon size={size} />
}
54 changes: 35 additions & 19 deletions src/custom/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { useState, useEffect } from 'react'
import { SupportedChainId as ChainId } from 'constants/chains'
import { Dots } from 'components/swap/styleds'
import Web3Status from 'components/Web3Status'
import { CardNoise } from 'components/earn/styled'
import { ExternalLink, TYPE } from 'theme'
import { ExternalLink } from 'theme'
import { useHistory } from 'react-router-dom'

import HeaderMod, {
Title,
Expand All @@ -18,7 +18,7 @@ import HeaderMod, {
StyledNavLink as StyledNavLinkUni,
StyledMenuButton,
HeaderFrame,
UNIAmount,
UNIAmount as UNIAmountMod,
UNIWrapper,
} from './HeaderMod'
import Menu from 'components/Menu'
Expand All @@ -37,13 +37,18 @@ import { supportedChainId } from 'utils/supportedChainId'
import { formatSmart } from 'utils/format'
import NetworkCard, { NetworkInfo } from './NetworkCard'
import SVG from 'react-inlinesvg'
import { useModalOpen, useShowClaimPopup, useToggleSelfClaimModal } from 'state/application/hooks'
import {
useModalOpen,
useShowClaimPopup,
// useToggleSelfClaimModal
} from 'state/application/hooks'
import { useUserHasAvailableClaim } from 'state/claim/hooks'
import { useUserHasSubmittedClaim } from 'state/transactions/hooks'

import Modal from 'components/Modal'
import ClaimModal from 'components/claim/ClaimModal'
// import ClaimModal from 'components/claim/ClaimModal'
import UniBalanceContent from 'components/Header/UniBalanceContent'
import CowProtocolLogo from 'components/CowProtocolLogo'

export const NETWORK_LABELS: { [chainId in ChainId]?: string } = {
[ChainId.RINKEBY]: 'Rinkeby',
Expand Down Expand Up @@ -200,6 +205,15 @@ const UniIcon = styled.div`
}
`

const VCowAmount = styled(UNIAmountMod)`
${({ theme }) => theme.cowToken.background};
${({ theme }) => theme.cowToken.boxShadow};
color: white;
padding: 0 16px;
display: flex;
align-items: center;
`

export default function Header() {
const { account, chainId: connectedChainId } = useActiveWeb3React()
const chainId = supportedChainId(connectedChainId)
Expand All @@ -208,7 +222,7 @@ export default function Header() {
const nativeToken = chainId && (CHAIN_CURRENCY_LABELS[chainId] || 'ETH')
const [darkMode, toggleDarkMode] = useDarkModeManager()

const toggleClaimModal = useToggleSelfClaimModal()
// const toggleClaimModal = useToggleSelfClaimModal()
const availableClaim: boolean = useUserHasAvailableClaim(account)
const { claimTxn } = useUserHasSubmittedClaim(account ?? undefined)
const [showUniBalanceModal, setShowUniBalanceModal] = useState(false)
Expand All @@ -219,6 +233,9 @@ export default function Header() {
const openOrdersPanel = () => setIsOrdersPanelOpen(true)
const isMenuOpen = useModalOpen(ApplicationModal.MENU)

const history = useHistory()
const handleOnClickClaim = () => history.push('/claim')

// Toggle the 'noScroll' class on body, whenever the orders panel or flyout menu is open.
// This removes the inner scrollbar on the page body, to prevent showing double scrollbars.
useEffect(() => {
Expand All @@ -231,7 +248,6 @@ export default function Header() {
<Wrapper>
<HeaderModWrapper>
<HeaderRow marginRight="0">
<ClaimModal />
<Modal isOpen={showUniBalanceModal} onDismiss={() => setShowUniBalanceModal(false)}>
<UniBalanceContent setShowUniBalanceModal={setShowUniBalanceModal} />
</Modal>
Expand All @@ -249,19 +265,19 @@ export default function Header() {
<NetworkCard />
<HeaderElement>
{availableClaim && !showClaimPopup && (
<UNIWrapper onClick={toggleClaimModal}>
<UNIAmount active={!!account && !availableClaim} style={{ pointerEvents: 'auto' }}>
<TYPE.white padding="0 2px">
{claimTxn && !claimTxn?.receipt ? (
<Dots>
<Trans>Claiming vCOW</Trans>
</Dots>
) : (
<UNIWrapper onClick={handleOnClickClaim}>
<VCowAmount active={!!account && !availableClaim} style={{ pointerEvents: 'auto' }}>
{claimTxn && !claimTxn?.receipt ? (
<Dots>
<Trans>Claiming vCOW...</Trans>
</Dots>
) : (
<>
<CowProtocolLogo />
<Trans>Claim vCOW</Trans>
)}
</TYPE.white>
</UNIAmount>
<CardNoise />
</>
)}
</VCowAmount>
</UNIWrapper>
)}
<AccountElement active={!!account} style={{ pointerEvents: 'auto' }}>
Expand Down
7 changes: 4 additions & 3 deletions src/custom/components/Modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { HeaderRow, ContentWrapper, CloseIcon, HoverText } from 'components/Wall
export * from '@src/components/Modal'
export { default } from '@src/components/Modal'

export const GpModal = styled(Modal)`
export const GpModal = styled(Modal)<{ maxWidth?: number; backgroundColor?: string; border?: string }>`
> [data-reach-dialog-content] {
background-color: ${({ theme }) => theme.bg1};
max-width: 470px;
background-color: ${({ backgroundColor, theme }) => (backgroundColor ? backgroundColor : theme.bg1)};
max-width: ${({ maxWidth }) => (maxWidth ? `${maxWidth}px` : '470px')};
border: ${({ border }) => (border ? border : 'inherit')};
z-index: 100;
${({ theme }) => theme.mediaWidth.upToSmall`
Expand Down
Loading

0 comments on commit 956c342

Please sign in to comment.