Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Omen Airdrop Popup Modal Version 2 #2220

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
357c9f5
fix: added new dai color to the theme palette
Frankaus Aug 24, 2021
42ed544
fix: removed Check Address functionality
Frankaus Aug 24, 2021
ca06282
fix: added new text
Frankaus Aug 24, 2021
541ff07
Merge branch 'master' of https://github.com/protofire/omen-exchange i…
Frankaus Aug 24, 2021
c2fa819
Update index.tsx
Frankaus Aug 24, 2021
26d059e
Merge branch 'master' into feature/2170
Frankaus Aug 24, 2021
25945a7
Merge branch 'feature/2170' of https://github.com/protofire/omen-exch…
Frankaus Aug 24, 2021
c8f09cb
feature: created Dai banner & dynamics
Frankaus Aug 25, 2021
a6d4dd9
fix: reverted IconExclamation edit
Frankaus Aug 25, 2021
2e6c9f5
fix: fix size values and reverted icon
Frankaus Aug 25, 2021
096209c
fix as per Milan feedback
Frankaus Aug 26, 2021
d4e6059
fix: changed margin top to 24px to add up to 32px with previous elem
Frankaus Aug 26, 2021
faba4a2
revert testing edit
Frankaus Aug 26, 2021
5487125
fix: fixed border issue
Frankaus Aug 26, 2021
cd62d5f
minor fix
Frankaus Aug 26, 2021
858807d
Merge branch 'master' into feature/2170
pimato Aug 27, 2021
b8d6c9e
Merge branch 'master' into feature/2170
Mi-Lan Aug 27, 2021
2f73be6
Merge branch 'feature/2170' of https://github.com/protofire/omen-exch…
Frankaus Aug 30, 2021
1b58557
fix Milan suggestion
Frankaus Aug 30, 2021
008da33
fix: dlete copy/paste markups
Frankaus Aug 30, 2021
7735326
fix IconExclamation
Frankaus Aug 30, 2021
51bc6a7
fix: added dust checker & claimAmount checker
Frankaus Aug 30, 2021
eddd8de
fix: added dust checker in airdrop card
Frankaus Aug 30, 2021
3965c3d
revert a change
Frankaus Aug 30, 2021
a30d6e2
Merge branch 'master' into feature/2170
pimato Aug 30, 2021
2ac8812
fix condition banner
Frankaus Aug 30, 2021
0e9d7ea
Merge branch 'master' into feature/2170
pimato Aug 30, 2021
362739f
created isDustxDai and applied it to airdrop modal
Frankaus Aug 30, 2021
2450405
fix
Frankaus Aug 30, 2021
c8acc33
Merge branch 'master' into feature/2170
Frankaus Aug 31, 2021
66f22c2
Merge branch 'master' into feature/2170
Mi-Lan Aug 31, 2021
9c91c86
fix: Reversed operators so that it works correctly
Mi-Lan Sep 1, 2021
768e6ac
Merge branch 'master' into feature/2170
Mi-Lan Sep 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/components/common/icons/IconExclamation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const IconExclamation = (props: Props) => (
>
<path
d="M7.2 10.4h1.6V12H7.2v-1.6zm0-6.4h1.6v4.8H7.2V4zm.792-4C3.576 0 0 3.584 0 8s3.576 8 7.992 8C12.416 16 16 12.416 16 8s-3.584-8-8.008-8zM8 14.4A6.398 6.398 0 011.6 8c0-3.536 2.864-6.4 6.4-6.4 3.536 0 6.4 2.864 6.4 6.4 0 3.536-2.864 6.4-6.4 6.4z"
fill="#7986CB"
fill={props.color ? props.color : '#7986CB'}
Frankaus marked this conversation as resolved.
Show resolved Hide resolved
Frankaus marked this conversation as resolved.
Show resolved Hide resolved
></path>
</svg>
)
3 changes: 2 additions & 1 deletion app/src/components/modal/common_styled/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export const ModalCard = styled.div`
border-radius: ${props => props.theme.cards.borderRadius};

&:nth-child(3),
&:nth-child(4) {
&:nth-child(4),
&:nth-child(6) {
margin-top: 16px;
}
`
Expand Down
57 changes: 31 additions & 26 deletions app/src/components/modal/modal_airdrop/airdrop_card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import { ButtonType } from '../../button/button_styling_types'
import { IconOmen } from '../../common/icons'
import { BalanceSection, ModalCard } from '../common_styled'

const TopSection = styled.div`
const TopSection = styled.div<{ displayCheckAddress: boolean }>`
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px;
width: 100%;
border-bottom: ${props => props.theme.borders.borderLineDisabled};
border-bottom: ${props => (props.displayCheckAddress ? props.theme.borders.borderLineDisabled : '')};
Frankaus marked this conversation as resolved.
Show resolved Hide resolved
`

const TopSectionLeft = styled.div`
Expand Down Expand Up @@ -52,35 +52,36 @@ const AirdropButton = styled(Button)`
`

interface Props extends HTMLAttributes<HTMLDivElement> {
theme: any
displayButtons?: boolean
displayAmount: BigNumber
claim?: (account: string, amount: BigNumber) => Promise<void>
displayAmount: BigNumber
displayButtons?: boolean
displayCheckAddress?: boolean
onCheckAddress?: () => void
theme: any
}

const AirdropCard = (props: Props) => {
const { claim, displayAmount, displayButtons = true, onCheckAddress } = props
const { claim, displayAmount, displayButtons = true, displayCheckAddress = true, onCheckAddress } = props

const { account } = useConnectedWeb3Context()
const { account, balances } = useConnectedWeb3Context()

const submitClaim = () => {
if (claim && account && displayAmount) {
claim(account, displayAmount)
}
}

const claimIsDisabled = !displayAmount || displayAmount.isZero()
const claimIsDisabled = !displayAmount || displayAmount.isZero() || balances.xDaiBalance.isZero()
Frankaus marked this conversation as resolved.
Show resolved Hide resolved

return (
<>
<ModalCard>
<TopSection>
<TopSection displayCheckAddress={displayCheckAddress}>
<TopSectionLeft>
<IconOmen id="airdrop" size={38} />
<TopSectionDetails>
<TYPE.bodyMedium color={'text1'}>Claimable Amount</TYPE.bodyMedium>
<TYPE.bodyMedium color={!claimIsDisabled ? 'profit' : 'text2'}>
<TYPE.bodyMedium color={displayAmount.isZero() ? 'text2' : 'profit'}>
{bigNumberToString(displayAmount, STANDARD_DECIMALS)} OMN
</TYPE.bodyMedium>
</TopSectionDetails>
Expand All @@ -91,24 +92,28 @@ const AirdropCard = (props: Props) => {
</AirdropButton>
)}
</TopSection>
<BottomSection>
<BottomSectionTextWrapper>
{displayCheckAddress && (
<BottomSection>
{' '}
{displayButtons ? (
<BottomSectionTextWrapper>
<TYPE.bodyMedium color={'text1'}>Claim OMN token</TYPE.bodyMedium>
<TYPE.bodyRegular color={'text2'}>check address for claimable OMN</TYPE.bodyRegular>
</BottomSectionTextWrapper>
<>
{' '}
<BottomSectionTextWrapper>
{' '}
<TYPE.bodyMedium color={'text1'}>Claim OMN token</TYPE.bodyMedium>{' '}
<TYPE.bodyRegular color={'text2'}>check address for claimable OMN</TYPE.bodyRegular>{' '}
</BottomSectionTextWrapper>{' '}
<AirdropButton onClick={onCheckAddress}>Check</AirdropButton>{' '}
</>
) : (
<BottomSectionTextWrapper>
<TYPE.bodyRegular color={'text2'}>
Enter an address to trigger a OMN claim. If the address has any claimable OMN it will be sent to them
on submission.
</TYPE.bodyRegular>
</BottomSectionTextWrapper>
)}
</BottomSectionTextWrapper>
{displayButtons && <AirdropButton onClick={onCheckAddress}>Check</AirdropButton>}
</BottomSection>
<TYPE.bodyRegular color={'text2'}>
{' '}
Enter an address to trigger a OMN claim. If the address has any claimable OMN it will be sent to them on
submission.{' '}
</TYPE.bodyRegular>
)}{' '}
</BottomSection>
)}
</ModalCard>
</>
)
Expand Down
38 changes: 28 additions & 10 deletions app/src/components/modal/modal_airdrop/index.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
import { BigNumber } from 'ethers/utils'
import React, { HTMLAttributes, useState } from 'react'
import Modal from 'react-modal'
import { withTheme } from 'styled-components'
import styled, { withTheme } from 'styled-components'

import { STANDARD_DECIMALS } from '../../../common/constants'
import { useConnectedWeb3Context } from '../../../contexts'
import { useAirdropService } from '../../../hooks'
import { TYPE } from '../../../theme'
import { bigNumberToString } from '../../../util/tools'
import { TransactionStep } from '../../../util/types'
import { IconClose, IconOmen } from '../../common/icons'
import { IconClose, IconExclamation, IconOmen } from '../../common/icons'
import { ContentWrapper, ModalNavigation, ModalNavigationLeft } from '../common_styled'
import { ModalTransactionWrapper } from '../modal_transaction'

import { AirdropCardWrapper } from './airdrop_card'
import { ModalCheckAddressWrapper } from './check_address'
import Graphic from './graphic'

const DaiBanner = styled.div`
display: flex;
align-items: center;
padding: 12px 16px;
border: 1px solid ${props => props.theme.dai};
border-radius: ${props => props.theme.cards.borderRadius};
width: 100%;
`

interface Props extends HTMLAttributes<HTMLDivElement> {
theme: any
}
Expand All @@ -30,6 +39,7 @@ export const ModalAirdrop = (props: Props) => {
const [checkAddress, setCheckAddress] = useState(false)
const [isTransactionModalOpen, setIsTransactionModalOpen] = useState<boolean>(false)
const [message, setMessage] = useState('')
const displayDaiBanner = balances.xDaiBalance.isZero()
Frankaus marked this conversation as resolved.
Show resolved Hide resolved

Modal.setAppElement('#root')

Expand Down Expand Up @@ -73,7 +83,21 @@ export const ModalAirdrop = (props: Props) => {
<IconClose hoverEffect={true} onClick={onClose} />
</ModalNavigation>
<Graphic />
<AirdropCardWrapper claim={claim} displayAmount={claimAmount} onCheckAddress={() => setCheckAddress(true)} />
<TYPE.heading2 color={'text1'} fontWeight={500} margin={'24px 0px 12px'}>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I edited the margin top here to 24px because the Graphic above has a margin bottom of 8px. So together they add up to 32px as per the figma design

OMN has arrived!
</TYPE.heading2>
<TYPE.bodyRegular color={'text2'} marginBottom={'32px'}>
Thanks for being part of the Omen Community.
</TYPE.bodyRegular>
{displayDaiBanner && (
<DaiBanner>
<IconExclamation color={theme.dai} />
<TYPE.bodyRegular color={'dai'} marginLeft={'12px'}>
Deposit Dai in order to claim OMN tokens.
</TYPE.bodyRegular>
</DaiBanner>
)}
<AirdropCardWrapper claim={claim} displayAmount={claimAmount} displayCheckAddress={false} />
</ContentWrapper>
</Modal>
<ModalTransactionWrapper
Expand All @@ -85,12 +109,6 @@ export const ModalAirdrop = (props: Props) => {
txHash={txHash}
txState={txState}
/>
<ModalCheckAddressWrapper
claim={claim}
isOpen={checkAddress && !isTransactionModalOpen}
onBack={() => setCheckAddress(false)}
onClose={onClose}
/>
</>
)
}
Expand Down
1 change: 1 addition & 0 deletions app/src/theme/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function colors(darkMode: boolean): Colors {
profit: darkMode ? '' : '#4B9E98',
alert: darkMode ? '' : '#E57373',
link: darkMode ? '' : '#1E88E5',
dai: darkMode ? '' : '#F9A606',

//border
border1: darkMode ? '' : '#DCDFF2',
Expand Down
1 change: 1 addition & 0 deletions app/src/theme/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface Colors {
profit: Color
alert: Color
link: Color
dai: Color

border1: Color
border2: Color
Expand Down