From 357c9f5e32e4b218b3f94fb0a7de58dfc5019568 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Tue, 24 Aug 2021 20:13:57 +0200 Subject: [PATCH 01/22] fix: added new dai color to the theme palette --- app/src/theme/index.tsx | 1 + app/src/theme/types.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/app/src/theme/index.tsx b/app/src/theme/index.tsx index 932ab6cee0..92788990d1 100644 --- a/app/src/theme/index.tsx +++ b/app/src/theme/index.tsx @@ -24,6 +24,7 @@ export function colors(darkMode: boolean): Colors { green: darkMode ? '' : '#4B9E98', red: darkMode ? '' : '#E57373', link: darkMode ? '' : '#1E88E5', + dai: darkMode ? '' : '#FBCC5F', //border border1: darkMode ? '' : '#DCDFF2', diff --git a/app/src/theme/types.ts b/app/src/theme/types.ts index 39ff6e4439..54627c9b7b 100644 --- a/app/src/theme/types.ts +++ b/app/src/theme/types.ts @@ -17,6 +17,7 @@ export interface Colors { green: Color red: Color link: Color + dai: Color border1: Color border2: Color From 42ed54440bca36cf2a413f3c7bd01617d66cbc40 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Tue, 24 Aug 2021 20:30:35 +0200 Subject: [PATCH 02/22] fix: removed Check Address functionality --- .../modal/modal_airdrop/airdrop_card.tsx | 41 ++++++++++--------- .../components/modal/modal_airdrop/index.tsx | 11 ++--- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index 38217503eb..46d296fd10 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -84,10 +84,11 @@ interface Props extends HTMLAttributes { displayAmount: BigNumber claim?: (account: string, amount: BigNumber) => Promise onCheckAddress?: () => void + showCheckAddress?: boolean } const AirdropCard = (props: Props) => { - const { claim, displayAmount, displayButtons = true, onCheckAddress } = props + const { claim, displayAmount, displayButtons = true, onCheckAddress, showCheckAddress = true } = props const { account } = useConnectedWeb3Context() @@ -118,24 +119,26 @@ const AirdropCard = (props: Props) => { )} - - - {displayButtons ? ( - - Claim OMN token - check address for claimable OMN - - ) : ( - - - Enter an address to trigger a OMN claim. If the address has any claimable OMN it will be sent to them - on submission. - - - )} - - {displayButtons && Check} - + {showCheckAddress && ( + + + {displayButtons ? ( + + Claim OMN token + check address for claimable OMN + + ) : ( + + + Enter an address to trigger a OMN claim. If the address has any claimable OMN it will be sent to + them on submission. + + + )} + + {displayButtons && Check} + + )} ) diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 65437ac218..c9172c110c 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -62,7 +62,8 @@ export const ModalAirdrop = (props: Props) => { return ( <> { - setCheckAddress(true)} /> + { txHash={txHash} txState={txState} /> - setCheckAddress(false)} - onClose={onClose} - /> ) } From ca062829d446b56dd5308d3c16cfd6c33a101438 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Tue, 24 Aug 2021 20:43:31 +0200 Subject: [PATCH 03/22] fix: added new text --- app/src/components/modal/modal_airdrop/index.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index c9172c110c..2681a02aa8 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -6,6 +6,7 @@ import { 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' @@ -74,6 +75,12 @@ export const ModalAirdrop = (props: Props) => { + + OMN has arrived! + + + Thanks for being part of the Omen Community. + From c2fa819fe7cb2adc13bc2798ac69da590d36507f Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Tue, 24 Aug 2021 21:20:50 +0200 Subject: [PATCH 04/22] Update index.tsx --- app/src/components/modal/modal_airdrop/index.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 2681a02aa8..a073b8ed1a 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ import { BigNumber } from 'ethers/utils' import React, { HTMLAttributes, useState } from 'react' import Modal from 'react-modal' @@ -25,6 +26,9 @@ export const ModalAirdrop = (props: Props) => { const { theme } = props const { balances, cpk, setTxState, txHash, txState } = useConnectedWeb3Context() + // console.log('balances: ', balances) + console.log('balances: ', balances.formattedxDaiBalance) + console.log('balances: ', parseFloat(balances.formattedxDaiBalance) === 0) const initialIsOpenState = localStorage.getItem('airdrop') const [isOpen, setIsOpen] = useState(!initialIsOpenState) @@ -63,8 +67,8 @@ export const ModalAirdrop = (props: Props) => { return ( <> Date: Wed, 25 Aug 2021 14:40:21 +0200 Subject: [PATCH 05/22] feature: created Dai banner & dynamics --- .../common/icons/IconExclamation.tsx | 2 +- .../components/modal/common_styled/index.tsx | 3 +- .../modal/modal_airdrop/airdrop_card.tsx | 19 +++++----- .../components/modal/modal_airdrop/index.tsx | 37 ++++++++++++++----- app/src/theme/index.tsx | 2 +- 5 files changed, 42 insertions(+), 21 deletions(-) diff --git a/app/src/components/common/icons/IconExclamation.tsx b/app/src/components/common/icons/IconExclamation.tsx index b8186cc129..3edd268f9e 100644 --- a/app/src/components/common/icons/IconExclamation.tsx +++ b/app/src/components/common/icons/IconExclamation.tsx @@ -14,7 +14,7 @@ export const IconExclamation = (props: Props) => ( > ) diff --git a/app/src/components/modal/common_styled/index.tsx b/app/src/components/modal/common_styled/index.tsx index 91694cd503..2d64337f67 100644 --- a/app/src/components/modal/common_styled/index.tsx +++ b/app/src/components/modal/common_styled/index.tsx @@ -33,7 +33,7 @@ export const ModalTitle = styled.p` margin-top: 2px; ` -export const ModalCard = styled.div` +export const ModalCard = styled.div<{ marginTop?: boolean }>` width: 100%; display: flex; @@ -41,6 +41,7 @@ export const ModalCard = styled.div` align-items: center; border: ${props => props.theme.borders.borderLineDisabled}; border-radius: ${props => props.theme.cards.borderRadius}; + ${props => props.marginTop && `margin-top: 16px;`}; &:nth-child(3), &:nth-child(4) { diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index 9dd6c50645..2dc407cfbe 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -52,18 +52,19 @@ const AirdropButton = styled(Button)` ` interface Props extends HTMLAttributes { - theme: any - displayButtons?: boolean - displayAmount: BigNumber claim?: (account: string, amount: BigNumber) => Promise + displayAmount: BigNumber + displayButtons?: boolean + displayCheckAddress?: boolean onCheckAddress?: () => void - showCheckAddress?: boolean + marginTop?: boolean + theme: any } const AirdropCard = (props: Props) => { - const { claim, displayAmount, displayButtons = true, onCheckAddress, showCheckAddress = true } = props + const { claim, displayAmount, displayButtons = true, displayCheckAddress = true, marginTop, onCheckAddress } = props - const { account } = useConnectedWeb3Context() + const { account, balances } = useConnectedWeb3Context() const submitClaim = () => { if (claim && account && displayAmount) { @@ -71,11 +72,11 @@ const AirdropCard = (props: Props) => { } } - const claimIsDisabled = !displayAmount || displayAmount.isZero() + const claimIsDisabled = !displayAmount || displayAmount.isZero() || parseFloat(balances.formattedxDaiBalance) === 0 return ( <> - + @@ -92,7 +93,7 @@ const AirdropCard = (props: Props) => { )} - {showCheckAddress && ( + {displayCheckAddress && ( {displayButtons ? ( diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index a073b8ed1a..2f88e91219 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -1,8 +1,7 @@ -/* eslint-disable no-console */ 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' @@ -10,14 +9,24 @@ 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; + flex-direction: row; + align-items: center; + padding: 12px 16px; + border: 1px solid ${props => props.theme.dai}; + border-radius: ${props => props.theme.cards.borderRadius}; + width: 100%; + margin: 16px 0px; +` + interface Props extends HTMLAttributes { theme: any } @@ -26,15 +35,13 @@ export const ModalAirdrop = (props: Props) => { const { theme } = props const { balances, cpk, setTxState, txHash, txState } = useConnectedWeb3Context() - // console.log('balances: ', balances) - console.log('balances: ', balances.formattedxDaiBalance) - console.log('balances: ', parseFloat(balances.formattedxDaiBalance) === 0) const initialIsOpenState = localStorage.getItem('airdrop') const [isOpen, setIsOpen] = useState(!initialIsOpenState) const [checkAddress, setCheckAddress] = useState(false) const [isTransactionModalOpen, setIsTransactionModalOpen] = useState(false) const [message, setMessage] = useState('') + const displayDaiBanner = parseFloat(balances.formattedxDaiBalance) === 0 Modal.setAppElement('#root') @@ -67,7 +74,6 @@ export const ModalAirdrop = (props: Props) => { return ( <> { Thanks for being part of the Omen Community. - + {displayDaiBanner && ( + + + + Deposit Dai in order to claim OMN tokens. + + + )} + Date: Wed, 25 Aug 2021 15:58:51 +0200 Subject: [PATCH 06/22] fix: reverted IconExclamation edit --- app/src/components/common/icons/IconExclamation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/common/icons/IconExclamation.tsx b/app/src/components/common/icons/IconExclamation.tsx index 3edd268f9e..b8186cc129 100644 --- a/app/src/components/common/icons/IconExclamation.tsx +++ b/app/src/components/common/icons/IconExclamation.tsx @@ -14,7 +14,7 @@ export const IconExclamation = (props: Props) => ( > ) From 2e6c9f57dc6a76149a6fc390e30246a3810b3a38 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Wed, 25 Aug 2021 18:11:01 +0200 Subject: [PATCH 07/22] fix: fix size values and reverted icon --- .../common/icons/IconExclamation.tsx | 2 +- .../components/modal/common_styled/index.tsx | 3 +- .../modal/modal_airdrop/airdrop_card.tsx | 2 +- .../components/modal/modal_airdrop/index.tsx | 32 ++++++++++++++----- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/app/src/components/common/icons/IconExclamation.tsx b/app/src/components/common/icons/IconExclamation.tsx index b8186cc129..3edd268f9e 100644 --- a/app/src/components/common/icons/IconExclamation.tsx +++ b/app/src/components/common/icons/IconExclamation.tsx @@ -14,7 +14,7 @@ export const IconExclamation = (props: Props) => ( > ) diff --git a/app/src/components/modal/common_styled/index.tsx b/app/src/components/modal/common_styled/index.tsx index 2d64337f67..dec7a1369c 100644 --- a/app/src/components/modal/common_styled/index.tsx +++ b/app/src/components/modal/common_styled/index.tsx @@ -41,11 +41,10 @@ export const ModalCard = styled.div<{ marginTop?: boolean }>` align-items: center; border: ${props => props.theme.borders.borderLineDisabled}; border-radius: ${props => props.theme.cards.borderRadius}; - ${props => props.marginTop && `margin-top: 16px;`}; &:nth-child(3), &:nth-child(4) { - margin-top: 16px; + margin-top: ${props => (props.marginTop ? `0px` : '16px')}; } ` diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index 2dc407cfbe..32393cd992 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -82,7 +82,7 @@ const AirdropCard = (props: Props) => { Claimable Amount - + {bigNumberToString(displayAmount, STANDARD_DECIMALS)} OMN diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 2f88e91219..8160e5794d 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -16,6 +16,14 @@ import { ModalTransactionWrapper } from '../modal_transaction' import { AirdropCardWrapper } from './airdrop_card' import Graphic from './graphic' +const TextSection = styled.div` + width: 100%; + display: flex; + flex-direction: column; + align-items: center; + margin: 32px 0px; +` + const DaiBanner = styled.div` display: flex; flex-direction: row; @@ -24,7 +32,7 @@ const DaiBanner = styled.div` border: 1px solid ${props => props.theme.dai}; border-radius: ${props => props.theme.cards.borderRadius}; width: 100%; - margin: 16px 0px; + margin-bottom: 16px; ` interface Props extends HTMLAttributes { @@ -85,16 +93,24 @@ export const ModalAirdrop = (props: Props) => { - - OMN has arrived! - - - Thanks for being part of the Omen Community. - + + + OMN has arrived! + + + Thanks for being part of the Omen Community. + + {displayDaiBanner && ( - + Deposit Dai in order to claim OMN tokens. From 096209c57c44fba54eb4f780b84d79a1fd055e1c Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Thu, 26 Aug 2021 12:37:01 +0200 Subject: [PATCH 08/22] fix as per Milan feedback --- .../components/modal/common_styled/index.tsx | 7 ++-- .../modal/modal_airdrop/airdrop_card.tsx | 7 ++-- .../components/modal/modal_airdrop/index.tsx | 41 ++++--------------- 3 files changed, 16 insertions(+), 39 deletions(-) diff --git a/app/src/components/modal/common_styled/index.tsx b/app/src/components/modal/common_styled/index.tsx index dec7a1369c..e91144cb83 100644 --- a/app/src/components/modal/common_styled/index.tsx +++ b/app/src/components/modal/common_styled/index.tsx @@ -33,7 +33,7 @@ export const ModalTitle = styled.p` margin-top: 2px; ` -export const ModalCard = styled.div<{ marginTop?: boolean }>` +export const ModalCard = styled.div` width: 100%; display: flex; @@ -43,8 +43,9 @@ export const ModalCard = styled.div<{ marginTop?: boolean }>` border-radius: ${props => props.theme.cards.borderRadius}; &:nth-child(3), - &:nth-child(4) { - margin-top: ${props => (props.marginTop ? `0px` : '16px')}; + &:nth-child(4), + &:nth-child(6) { + margin-top: 16px; } ` diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index 32393cd992..11f2d55f83 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -57,12 +57,11 @@ interface Props extends HTMLAttributes { displayButtons?: boolean displayCheckAddress?: boolean onCheckAddress?: () => void - marginTop?: boolean theme: any } const AirdropCard = (props: Props) => { - const { claim, displayAmount, displayButtons = true, displayCheckAddress = true, marginTop, onCheckAddress } = props + const { claim, displayAmount, displayButtons = true, displayCheckAddress = true, onCheckAddress } = props const { account, balances } = useConnectedWeb3Context() @@ -72,11 +71,11 @@ const AirdropCard = (props: Props) => { } } - const claimIsDisabled = !displayAmount || displayAmount.isZero() || parseFloat(balances.formattedxDaiBalance) === 0 + const claimIsDisabled = !displayAmount || displayAmount.isZero() || balances.xDaiBalance.isZero() return ( <> - + diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 8160e5794d..81a5ee5110 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -16,23 +16,13 @@ import { ModalTransactionWrapper } from '../modal_transaction' import { AirdropCardWrapper } from './airdrop_card' import Graphic from './graphic' -const TextSection = styled.div` - width: 100%; - display: flex; - flex-direction: column; - align-items: center; - margin: 32px 0px; -` - const DaiBanner = styled.div` display: flex; - flex-direction: row; align-items: center; padding: 12px 16px; border: 1px solid ${props => props.theme.dai}; border-radius: ${props => props.theme.cards.borderRadius}; width: 100%; - margin-bottom: 16px; ` interface Props extends HTMLAttributes { @@ -49,7 +39,7 @@ export const ModalAirdrop = (props: Props) => { const [checkAddress, setCheckAddress] = useState(false) const [isTransactionModalOpen, setIsTransactionModalOpen] = useState(false) const [message, setMessage] = useState('') - const displayDaiBanner = parseFloat(balances.formattedxDaiBalance) === 0 + const displayDaiBanner = balances.xDaiBalance.isZero() Modal.setAppElement('#root') @@ -93,34 +83,21 @@ export const ModalAirdrop = (props: Props) => { - - - OMN has arrived! - - - Thanks for being part of the Omen Community. - - + + OMN has arrived! + + + Thanks for being part of the Omen Community. + {displayDaiBanner && ( - + Deposit Dai in order to claim OMN tokens. )} - + Date: Thu, 26 Aug 2021 14:55:20 +0200 Subject: [PATCH 09/22] fix: changed margin top to 24px to add up to 32px with previous elem --- app/src/components/modal/modal_airdrop/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 81a5ee5110..a7e5b7da9c 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -72,7 +72,8 @@ export const ModalAirdrop = (props: Props) => { return ( <> { - + OMN has arrived! From faba4a217a99d52764787d32c728506f30228f75 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Thu, 26 Aug 2021 14:56:27 +0200 Subject: [PATCH 10/22] revert testing edit --- app/src/components/modal/modal_airdrop/index.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index a7e5b7da9c..308f275b93 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -72,8 +72,7 @@ export const ModalAirdrop = (props: Props) => { return ( <> Date: Thu, 26 Aug 2021 16:17:20 +0200 Subject: [PATCH 11/22] fix: fixed border issue --- app/src/components/modal/modal_airdrop/airdrop_card.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index 11f2d55f83..7be4a2b711 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -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 : '')}; ` const TopSectionLeft = styled.div` @@ -76,7 +76,7 @@ const AirdropCard = (props: Props) => { return ( <> - + From cd62d5fead67e8d8087b2b73200b105972c91808 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Thu, 26 Aug 2021 16:21:51 +0200 Subject: [PATCH 12/22] minor fix --- app/src/components/modal/modal_airdrop/airdrop_card.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index 7be4a2b711..64e485266b 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -11,7 +11,7 @@ import { ButtonType } from '../../button/button_styling_types' import { IconOmen } from '../../common/icons' import { BalanceSection, ModalCard } from '../common_styled' -const TopSection = styled.div<{ displayCheckAddress?: boolean }>` +const TopSection = styled.div<{ displayCheckAddress: boolean }>` display: flex; align-items: center; justify-content: space-between; From 1b58557eae18ec52e9145a54a77d0129a7d97f78 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Mon, 30 Aug 2021 12:30:48 +0200 Subject: [PATCH 13/22] fix Milan suggestion --- .../modal/modal_airdrop/airdrop_card.tsx | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index 64e485266b..e9da22cb99 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -94,22 +94,24 @@ const AirdropCard = (props: Props) => { {displayCheckAddress && ( - - {displayButtons ? ( + {' '} + {displayButtons ? ( + <> + {' '} - Claim OMN token - check address for claimable OMN - - ) : ( - - - Enter an address to trigger a OMN claim. If the address has any claimable OMN it will be sent to - them on submission. - - - )} - - {displayButtons && Check} + {' '} + Claim OMN token{' '} + check address for claimable OMN{' '} + {' '} + Check{' '} + + ) : ( + + {' '} + Enter an address to trigger a OMN claim. If the address has any claimable OMN it will be sent to them on + submission.{' '} + + )}{' '} )} From 008da33676eddb3ffc6cd17d41aaf3550c1d6325 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Mon, 30 Aug 2021 12:39:28 +0200 Subject: [PATCH 14/22] fix: dlete copy/paste markups --- .../modal/modal_airdrop/airdrop_card.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index e9da22cb99..65adfc5dfc 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -94,24 +94,20 @@ const AirdropCard = (props: Props) => { {displayCheckAddress && ( - {' '} {displayButtons ? ( <> - {' '} - {' '} - Claim OMN token{' '} - check address for claimable OMN{' '} - {' '} - Check{' '} + Claim OMN token + check address for claimable OMN + + Check ) : ( - {' '} Enter an address to trigger a OMN claim. If the address has any claimable OMN it will be sent to them on - submission.{' '} + submission. - )}{' '} + )} )} From 77353262c9d251163ce4593ae1ed10bb4c6f9440 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Mon, 30 Aug 2021 12:57:35 +0200 Subject: [PATCH 15/22] fix IconExclamation --- .../common/icons/IconExclamation.tsx | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/app/src/components/common/icons/IconExclamation.tsx b/app/src/components/common/icons/IconExclamation.tsx index 3edd268f9e..122ada4ff2 100644 --- a/app/src/components/common/icons/IconExclamation.tsx +++ b/app/src/components/common/icons/IconExclamation.tsx @@ -4,17 +4,14 @@ interface Props { color?: string } -export const IconExclamation = (props: Props) => ( - - - -) +export const IconExclamation = (props: Props) => { + const { color = '#7986CB' } = props + return ( + + + + ) +} From 51bc6a7d7ce71ea9209d4fc528f93f47302f0179 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Mon, 30 Aug 2021 15:27:56 +0200 Subject: [PATCH 16/22] fix: added dust checker & claimAmount checker --- app/src/components/modal/modal_airdrop/index.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 308f275b93..06184e725d 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -7,7 +7,7 @@ import { STANDARD_DECIMALS } from '../../../common/constants' import { useConnectedWeb3Context } from '../../../contexts' import { useAirdropService } from '../../../hooks' import { TYPE } from '../../../theme' -import { bigNumberToString } from '../../../util/tools' +import { bigNumberToString, isDust } from '../../../util/tools' import { TransactionStep } from '../../../util/types' import { IconClose, IconExclamation, IconOmen } from '../../common/icons' import { ContentWrapper, ModalNavigation, ModalNavigationLeft } from '../common_styled' @@ -39,12 +39,14 @@ export const ModalAirdrop = (props: Props) => { const [checkAddress, setCheckAddress] = useState(false) const [isTransactionModalOpen, setIsTransactionModalOpen] = useState(false) const [message, setMessage] = useState('') - const displayDaiBanner = balances.xDaiBalance.isZero() - - Modal.setAppElement('#root') const { claimAmount, fetchClaimAmount } = useAirdropService() + const noDustInDaiBalance = !isDust(balances.xDaiBalance, 18) + const displayDaiBanner = balances.xDaiBalance.isZero() && !noDustInDaiBalance && !claimAmount.isZero() + + Modal.setAppElement('#root') + const onClose = () => { localStorage.setItem('airdrop', 'displayed') setIsTransactionModalOpen(false) From eddd8de7135c7cabb03d71225005311106de496f Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Mon, 30 Aug 2021 15:36:20 +0200 Subject: [PATCH 17/22] fix: added dust checker in airdrop card --- app/src/components/modal/modal_airdrop/airdrop_card.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index 65adfc5dfc..dc78c9b073 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -5,7 +5,7 @@ import styled, { withTheme } from 'styled-components' import { STANDARD_DECIMALS } from '../../../common/constants' import { useConnectedWeb3Context } from '../../../contexts' import { TYPE } from '../../../theme' -import { bigNumberToString } from '../../../util/tools' +import { bigNumberToString, isDust } from '../../../util/tools' import { Button } from '../../button' import { ButtonType } from '../../button/button_styling_types' import { IconOmen } from '../../common/icons' @@ -70,8 +70,9 @@ const AirdropCard = (props: Props) => { claim(account, displayAmount) } } - - const claimIsDisabled = !displayAmount || displayAmount.isZero() || balances.xDaiBalance.isZero() + const noDustInDaiBalance = !isDust(balances.xDaiBalance, 18) + const claimIsDisabled = + !displayAmount || displayAmount.isZero() || balances.xDaiBalance.isZero() || !noDustInDaiBalance return ( <> From 3965c3db76c3eb9d084abd0dc94de26f7c414015 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Mon, 30 Aug 2021 15:43:43 +0200 Subject: [PATCH 18/22] revert a change --- app/src/components/modal/modal_airdrop/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 06184e725d..34691d5547 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -43,7 +43,7 @@ export const ModalAirdrop = (props: Props) => { const { claimAmount, fetchClaimAmount } = useAirdropService() const noDustInDaiBalance = !isDust(balances.xDaiBalance, 18) - const displayDaiBanner = balances.xDaiBalance.isZero() && !noDustInDaiBalance && !claimAmount.isZero() + const displayDaiBanner = balances.xDaiBalance.isZero() && !noDustInDaiBalance Modal.setAppElement('#root') From 2ac8812db1969df05cd0f04ba876375056d82759 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Mon, 30 Aug 2021 17:26:06 +0200 Subject: [PATCH 19/22] fix condition banner --- app/src/components/modal/modal_airdrop/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 34691d5547..6cdc51d920 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -43,7 +43,7 @@ export const ModalAirdrop = (props: Props) => { const { claimAmount, fetchClaimAmount } = useAirdropService() const noDustInDaiBalance = !isDust(balances.xDaiBalance, 18) - const displayDaiBanner = balances.xDaiBalance.isZero() && !noDustInDaiBalance + const displayDaiBanner = !noDustInDaiBalance Modal.setAppElement('#root') From 362739fa344aab5a6b84ae1135d714eda2d70463 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Mon, 30 Aug 2021 20:03:58 +0200 Subject: [PATCH 20/22] created isDustxDai and applied it to airdrop modal --- app/src/components/modal/modal_airdrop/index.tsx | 4 ++-- app/src/util/tools/web3.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 6cdc51d920..6873935579 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -7,7 +7,7 @@ import { STANDARD_DECIMALS } from '../../../common/constants' import { useConnectedWeb3Context } from '../../../contexts' import { useAirdropService } from '../../../hooks' import { TYPE } from '../../../theme' -import { bigNumberToString, isDust } from '../../../util/tools' +import { bigNumberToString, isDustxDai } from '../../../util/tools' import { TransactionStep } from '../../../util/types' import { IconClose, IconExclamation, IconOmen } from '../../common/icons' import { ContentWrapper, ModalNavigation, ModalNavigationLeft } from '../common_styled' @@ -42,7 +42,7 @@ export const ModalAirdrop = (props: Props) => { const { claimAmount, fetchClaimAmount } = useAirdropService() - const noDustInDaiBalance = !isDust(balances.xDaiBalance, 18) + const noDustInDaiBalance = !isDustxDai(balances.xDaiBalance, 18) const displayDaiBanner = !noDustInDaiBalance Modal.setAppElement('#root') diff --git a/app/src/util/tools/web3.ts b/app/src/util/tools/web3.ts index c33123567b..c115fc95a9 100644 --- a/app/src/util/tools/web3.ts +++ b/app/src/util/tools/web3.ts @@ -95,6 +95,10 @@ export const isDust = (amount: BigNumber, decimals: number): boolean => { return amount.lt(parseUnits('0.00001', decimals)) } +export const isDustxDai = (amount: BigNumber, decimals: number): boolean => { + return amount.lt(parseUnits('0.01', decimals)) +} + export const clampBigNumber = (x: BigNumber, min: BigNumber, max: BigNumber): BigNumber => { if (x.lt(min)) return min if (x.gt(max)) return max From 2450405b7236b77c5514e88bc437339a51a56d01 Mon Sep 17 00:00:00 2001 From: Francesco Vauban Date: Mon, 30 Aug 2021 21:20:03 +0200 Subject: [PATCH 21/22] fix --- app/src/components/modal/modal_airdrop/airdrop_card.tsx | 5 ++--- app/src/components/modal/modal_airdrop/index.tsx | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index dc78c9b073..b1fd6057be 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -5,7 +5,7 @@ import styled, { withTheme } from 'styled-components' import { STANDARD_DECIMALS } from '../../../common/constants' import { useConnectedWeb3Context } from '../../../contexts' import { TYPE } from '../../../theme' -import { bigNumberToString, isDust } from '../../../util/tools' +import { bigNumberToString, isDustxDai } from '../../../util/tools' import { Button } from '../../button' import { ButtonType } from '../../button/button_styling_types' import { IconOmen } from '../../common/icons' @@ -70,9 +70,8 @@ const AirdropCard = (props: Props) => { claim(account, displayAmount) } } - const noDustInDaiBalance = !isDust(balances.xDaiBalance, 18) const claimIsDisabled = - !displayAmount || displayAmount.isZero() || balances.xDaiBalance.isZero() || !noDustInDaiBalance + !displayAmount || displayAmount.isZero() || balances.xDaiBalance.isZero() || !isDustxDai(balances.xDaiBalance, 18) return ( <> diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 6873935579..9eabe6434e 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -42,8 +42,7 @@ export const ModalAirdrop = (props: Props) => { const { claimAmount, fetchClaimAmount } = useAirdropService() - const noDustInDaiBalance = !isDustxDai(balances.xDaiBalance, 18) - const displayDaiBanner = !noDustInDaiBalance + const displayDaiBanner = !isDustxDai(balances.xDaiBalance, 18) Modal.setAppElement('#root') From 9c91c86d35336e0ff559c0847a7793c1a01f6b82 Mon Sep 17 00:00:00 2001 From: My Violet Date: Wed, 1 Sep 2021 11:56:48 +0200 Subject: [PATCH 22/22] fix: Reversed operators so that it works correctly --- app/src/components/modal/modal_airdrop/airdrop_card.tsx | 3 +-- app/src/components/modal/modal_airdrop/index.tsx | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/components/modal/modal_airdrop/airdrop_card.tsx b/app/src/components/modal/modal_airdrop/airdrop_card.tsx index b1fd6057be..e87a9935d2 100644 --- a/app/src/components/modal/modal_airdrop/airdrop_card.tsx +++ b/app/src/components/modal/modal_airdrop/airdrop_card.tsx @@ -70,8 +70,7 @@ const AirdropCard = (props: Props) => { claim(account, displayAmount) } } - const claimIsDisabled = - !displayAmount || displayAmount.isZero() || balances.xDaiBalance.isZero() || !isDustxDai(balances.xDaiBalance, 18) + const claimIsDisabled = !displayAmount || displayAmount.isZero() || isDustxDai(balances.xDaiBalance, 18) return ( <> diff --git a/app/src/components/modal/modal_airdrop/index.tsx b/app/src/components/modal/modal_airdrop/index.tsx index 9eabe6434e..1afa8a2e92 100644 --- a/app/src/components/modal/modal_airdrop/index.tsx +++ b/app/src/components/modal/modal_airdrop/index.tsx @@ -42,7 +42,7 @@ export const ModalAirdrop = (props: Props) => { const { claimAmount, fetchClaimAmount } = useAirdropService() - const displayDaiBanner = !isDustxDai(balances.xDaiBalance, 18) + const displayDaiBanner = isDustxDai(balances.xDaiBalance, 18) Modal.setAppElement('#root')