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/guild #2167

Merged
merged 24 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c9786f3
Guild Token Lock (#1908)
Mi-Lan Jul 1, 2021
01419ea
feature/1861 (#1907)
hexyls Jul 3, 2021
20ffd3a
feature: add airdrop card to guild modal
hexyls Jul 20, 2021
4bd1cc3
fix: style changes, testing airdrop
hexyls Jul 21, 2021
f35e307
style: Reduce margin from 32px to 24px for diver and button group
Jul 21, 2021
c1781d3
fix: refetch claimable balance
hexyls Jul 22, 2021
e16145c
Merge branch 'feature/airdrop-guild-modal' of github.com:protofire/om…
hexyls Jul 22, 2021
9338323
fix: reset check address claim amount
hexyls Jul 22, 2021
a85e345
fix: display omen account on tight integration
hexyls Jul 22, 2021
76d783e
fix: capitalize wallet balance
hexyls Jul 22, 2021
f087c0b
feature: add airdrop for dxd holders
hexyls Jul 23, 2021
2b7959a
Add airdrop card to guild modal (#2112)
hexyls Jul 26, 2021
6ce1eae
Merge branch 'feature/guild' into fix/2114
hexyls Jul 28, 2021
80cbe2c
Merge branch 'feature/guild' into feature/2093
hexyls Jul 28, 2021
b0ffd3c
feature: redeploy both airdrops
hexyls Jul 28, 2021
464c75d
Combined (relay+eoa) OMN balance in header (#2139)
hexyls Aug 9, 2021
1539a8c
Merge pull request #2121 from protofire/fix/2114
hexyls Aug 10, 2021
39dce76
Merge branch 'feature/guild' into feature/2093
hexyls Aug 10, 2021
38f40d1
fix: fetch claims from github
hexyls Aug 10, 2021
f395fee
Merge branch 'feature/2093' of github.com:protofire/omen-exchange int…
hexyls Aug 10, 2021
2ecb1fb
fix: add claim recipient field
hexyls Aug 10, 2021
e2af478
Merge pull request #2122 from protofire/feature/2093
hexyls Aug 10, 2021
91947dc
Merge branch 'master' into feature/guild
hexyls Aug 11, 2021
a7b0679
fix: attempt to resolve merge issues, move code to cpk pipes
hexyls Aug 11, 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
1 change: 0 additions & 1 deletion app/src/components/button/button_styling_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export const ButtonCSS = css`
padding: 12px 17px;
pointer-events: ${props => ((props as any).disabled ? 'none' : 'initial')};
text-align: center;
transition: all 0.15s ease-out;
user-select: none;
white-space: nowrap;
font-family: Roboto;
Expand Down
27 changes: 24 additions & 3 deletions app/src/components/common/icons/IconAlertInverted.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
import React from 'react'
import styled from 'styled-components'

interface Props {
style?: any
size?: string
}

const StyledSvg = styled.svg`
cursor: pointer;
&:hover {
circle {
stroke: ${props => props.theme.dropdown.buttonBorderColorHover};
}
path {
fill: ${props => props.theme.dropdown.buttonColorHover};
}
}
`

export const IconAlertInverted = (props: Props) => {
const { style } = props
const { size = '20', ...restProps } = props
return (
<svg fill="none" height="20" style={style} viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg">
<StyledSvg
{...restProps}
fill="none"
height={size}
viewBox="0 0 20 20"
width={size}
xmlns="http://www.w3.org/2000/svg"
>
<circle cx="10" cy="10" r="9.5" stroke="#DCDFF2" />
<path
d="M9 14C9 13.4477 9.44772 13 10 13C10.5523 13 11 13.4477 11 14C11 14.5523 10.5523 15 10 15C9.44772 15 9 14.5523 9 14ZM9.12498 5H10.875V11H9.12498V5Z"
fill="#86909E"
/>
</svg>
</StyledSvg>
)
}
5 changes: 3 additions & 2 deletions app/src/components/common/icons/IconArrowBack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ const Wrapper = styled.svg<{ hoverEffect: boolean }>`
interface Props {
hoverEffect?: boolean
onClick?: () => void
style?: any
}

export const IconArrowBack = (props: Props) => {
const { hoverEffect = false, onClick } = props
const { hoverEffect = false, ...restProps } = props

return (
<Wrapper
fill="none"
height="24"
hoverEffect={hoverEffect}
onClick={onClick}
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
{...restProps}
>
<path
className="path"
Expand Down
36 changes: 27 additions & 9 deletions app/src/components/common/icons/IconArrowRightLong.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
import React from 'react'
import styled from 'styled-components'

export const IconArrowRightLong = () => (
<svg fill="none" height="14" viewBox="0 0 18 14" width="18" xmlns="http://www.w3.org/2000/svg">
<path
className="arrow-path"
d="M12.1163 0.928154C12.0593 0.860436 11.9887 0.805227 11.9091 0.766048C11.8294 0.726868 11.7423 0.704578 11.6535 0.700598C11.5646 0.696618 11.4759 0.711035 11.393 0.742931C11.3101 0.774827 11.2347 0.823501 11.1718 0.885851C11.109 0.9482 11.0599 1.02286 11.0277 1.10506C10.9955 1.18727 10.981 1.27522 10.985 1.3633C10.989 1.45139 11.0115 1.53768 11.051 1.61667C11.0905 1.69566 11.1462 1.76563 11.2145 1.8221L15.8153 6.38836H0.608036C0.443872 6.397 0.289304 6.46773 0.176181 6.58598C0.0630584 6.70423 0 6.86099 0 7.02396C0 7.18693 0.0630584 7.34369 0.176181 7.46194C0.289304 7.58019 0.443872 7.65092 0.608036 7.65955H15.8153L11.2073 12.2205C11.0913 12.3409 11.0266 12.5009 11.0266 12.6674C11.0266 12.8339 11.0913 12.994 11.2073 13.1144C11.2665 13.1732 11.3367 13.2199 11.4141 13.2517C11.4915 13.2836 11.5744 13.3 11.6582 13.3C11.742 13.3 11.8249 13.2836 11.9023 13.2517C11.9797 13.2199 12.0499 13.1732 12.1091 13.1144L17.8082 7.46467C17.8688 7.40679 17.9171 7.33737 17.9501 7.26057C17.983 7.18377 18 7.10116 18 7.0177C18 6.93424 17.983 6.85163 17.9501 6.77483C17.9171 6.69803 17.8688 6.62861 17.8082 6.57073L12.1163 0.928154Z"
fill="#DCDFF2"
/>
</svg>
)
interface Props {
width?: number
color?: string
height?: number
style?: any
}
const SvgStyled = styled.svg``
export const IconArrowRightLong = (props: Props) => {
const { color = '#DCDFF2', height = 14, style, width = 18 } = props
return (
<SvgStyled
fill="none"
height={height}
style={style}
viewBox="0 0 18 14"
width={width}
xmlns="http://www.w3.org/2000/svg"
>
<path
className="arrow-path"
d="M12.1163 0.928154C12.0593 0.860436 11.9887 0.805227 11.9091 0.766048C11.8294 0.726868 11.7423 0.704578 11.6535 0.700598C11.5646 0.696618 11.4759 0.711035 11.393 0.742931C11.3101 0.774827 11.2347 0.823501 11.1718 0.885851C11.109 0.9482 11.0599 1.02286 11.0277 1.10506C10.9955 1.18727 10.981 1.27522 10.985 1.3633C10.989 1.45139 11.0115 1.53768 11.051 1.61667C11.0905 1.69566 11.1462 1.76563 11.2145 1.8221L15.8153 6.38836H0.608036C0.443872 6.397 0.289304 6.46773 0.176181 6.58598C0.0630584 6.70423 0 6.86099 0 7.02396C0 7.18693 0.0630584 7.34369 0.176181 7.46194C0.289304 7.58019 0.443872 7.65092 0.608036 7.65955H15.8153L11.2073 12.2205C11.0913 12.3409 11.0266 12.5009 11.0266 12.6674C11.0266 12.8339 11.0913 12.994 11.2073 13.1144C11.2665 13.1732 11.3367 13.2199 11.4141 13.2517C11.4915 13.2836 11.5744 13.3 11.6582 13.3C11.742 13.3 11.8249 13.2836 11.9023 13.2517C11.9797 13.2199 12.0499 13.1732 12.1091 13.1144L17.8082 7.46467C17.8688 7.40679 17.9171 7.33737 17.9501 7.26057C17.983 7.18377 18 7.10116 18 7.0177C18 6.93424 17.983 6.85163 17.9501 6.77483C17.9171 6.69803 17.8688 6.62861 17.8082 6.57073L12.1163 0.928154Z"
fill={color}
/>
</SvgStyled>
)
}
20 changes: 16 additions & 4 deletions app/src/components/common/layout/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ import { matchPath } from 'react-router-dom'
import ReactTooltip from 'react-tooltip'
import styled, { css } from 'styled-components'

import { Network } from '../..'
import { Logo, STANDARD_DECIMALS } from '../../../../common/constants'
import { useConnectedWeb3Context } from '../../../../contexts'
import { networkIds } from '../../../../util/networks'
import { bigNumberToString } from '../../../../util/tools'
import { ExchangeType } from '../../../../util/types'
import { Button, ButtonCircle, ButtonRound } from '../../../button'
import { ButtonType } from '../../../button/button_styling_types'
import { ModalConnectWalletWrapper, ModalDepositWithdrawWrapper, ModalYourConnectionWrapper } from '../../../modal'
import {
ModalConnectWalletWrapper,
ModalDepositWithdrawWrapper,
ModalLockYoTokens,
ModalYourConnectionWrapper,
} from '../../../modal'
import { Dropdown, DropdownItemProps, DropdownPosition } from '../../form/dropdown'
import { IconAdd, IconClose, IconOmen } from '../../icons'
import { Network } from '../../network'

export const HeaderWrapper = styled.div`
align-items: center;
Expand Down Expand Up @@ -183,13 +188,15 @@ const OmenIconWrapper = styled.div`

const HeaderContainer: React.FC = (props: any) => {
const context = useConnectedWeb3Context()

const { relay, toggleRelay } = context
const { account, active, connectorName, error, networkId } = context.rawWeb3Context

const { history, ...restProps } = props
const [isConnectWalletModalOpen, setConnectWalletModalState] = useState(false)
const [isYourConnectionModalOpen, setYourConnectionModalState] = useState(false)
const [isDepositWithdrawModalOpen, setDepositWithdrawModalState] = useState(false)
const [isModalLockTokensOpen, setModalLockTokensState] = useState<boolean>(false)
const [depositWithdrawType, setDepositWithdrawType] = useState<ExchangeType>(ExchangeType.deposit)
const [marketPage, setMarketPage] = useState(true)

Expand Down Expand Up @@ -316,9 +323,8 @@ const HeaderContainer: React.FC = (props: any) => {
placeholder={networkPlacholder}
/>
)}

{account && (
<HeaderButton style={{ display: 'none' }}>
<HeaderButton onClick={() => setModalLockTokensState(!isModalLockTokensOpen)}>
{relay
? `${bigNumberToString(xOmenBalance, STANDARD_DECIMALS, 0)}`
: `${bigNumberToString(omenBalance, STANDARD_DECIMALS, 0)}`}
Expand Down Expand Up @@ -361,6 +367,12 @@ const HeaderContainer: React.FC = (props: any) => {
</HeaderButton>
)}
</ContentsRight>
<ModalLockYoTokens
context={context}
isOpen={isModalLockTokensOpen}
onClose={() => setModalLockTokensState(false)}
setIsModalLockTokensOpen={setModalLockTokensState}
/>
<ModalYourConnectionWrapper
arrayOfClaimableBalances={arrayOfClaimableTokenBalances}
changeWallet={() => {
Expand Down
3 changes: 3 additions & 0 deletions app/src/components/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import { MarketWizardCreatorContainer } from '../../pages/market_sections/market
import { MainScroll, MainWrapper, WrongNetworkMessage } from '../common'
import { Footer } from '../common/layout/footer'
import { Header } from '../common/layout/header'
import { ModalAirdropWrapper } from '../modal'
import SettingsViewContainer from '../settings/settings_view'

import { MarketRoutes } from './routes/market_routes'

const RedirectToHome = () => <Redirect to="/" />

export const Main: React.FC = () => {
Expand All @@ -22,6 +24,7 @@ export const Main: React.FC = () => {
<Router>
<MainWrapper>
<Header />
<ModalAirdropWrapper />
<Helmet>
<title>{DOCUMENT_TITLE}</title>
</Helmet>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import React from 'react'

export const ArrowIcon: React.FC = () => (
<svg fill="none" height="8" viewBox="0 0 11 8" width="11" xmlns="http://www.w3.org/2000/svg">
<path d="M7.01 3H0V5H7.01V8L11 4L7.01 0V3Z" />
</svg>
)
interface Props {
color?: string
style?: any
}
export const ArrowIcon = (props: Props) => {
const { color = 'none' } = props
return (
<svg fill={color} height="8" style={props.style} viewBox="0 0 11 8" width="11" xmlns="http://www.w3.org/2000/svg">
<path d="M7.01 3H0V5H7.01V8L11 4L7.01 0V3Z" />
</svg>
)
}
2 changes: 2 additions & 0 deletions app/src/components/modal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ export { ModalConnectWalletWrapper } from '../modal/modal_connect_wallet'
export { ModalYourConnectionWrapper } from './modal_your_connection'
export { ModalDepositWithdrawWrapper } from './modal_deposit_withdraw'
export { ModalTransactionWrapper } from './modal_transaction'
export { ModalAirdropWrapper } from './modal_airdrop'
export { ModalLockYoTokens } from './modal_lock_yo_tokens'
144 changes: 144 additions & 0 deletions app/src/components/modal/modal_airdrop/airdrop_card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import { BigNumber } from 'ethers/utils'
import React, { HTMLAttributes } from 'react'
import styled, { withTheme } from 'styled-components'

import { STANDARD_DECIMALS } from '../../../common/constants'
import { useConnectedWeb3Context } from '../../../contexts'
import { bigNumberToString } from '../../../util/tools'
import { Button } from '../../button'
import { ButtonType } from '../../button/button_styling_types'
import { IconOmen } from '../../common/icons'
import { BalanceSection, ModalCard } from '../common_styled'

const TopSection = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
padding: 20px;
width: 100%;
border-bottom: ${props => props.theme.borders.borderLineDisabled};
`

const TopSectionLeft = styled.div`
display: flex;
flex-direction: row;
align-items: center;
`

const TopSectionDetails = styled.div`
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 0;
margin-left: 16px;
`

const TopSectionHeading = styled.div`
color: ${props => props.theme.colors.textColorDark};
font-weight: ${props => props.theme.textfield.fontWeight};
`

interface Subheading {
green: boolean
}

const TopSectionSubHeading = styled.div<Subheading>`
color: ${props => (props.green ? props.theme.colors.green : props.theme.colors.textColorLighter)};
font-weight: ${props => props.theme.textfield.fontWeight};
`

const BottomSection = styled(BalanceSection as any)`
display: flex;
align-items: center;
justify-content: space-between;
flex-direction: row;
`

const BottomSectionTextWrapper = styled.div`
display: flex;
flex-direction: column;
align-items: flex-start;
`

const BottomSectionHeading = styled.div`
color: ${props => props.theme.colors.textColorDark};
font-weight: ${props => props.theme.textfield.fontWeight};
`

const BottomSectionSubheading = styled.div`
color: ${props => props.theme.colors.textColorLighter};
font-size: ${props => props.theme.fonts.defaultSize};
`

const BottomSectionDescription = styled.div`
color: ${props => props.theme.colors.textColorLighter};
`

const AirdropButton = styled(Button)`
width: 75px;
`

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

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

const { account } = useConnectedWeb3Context()

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

const claimIsDisabled = !displayAmount || displayAmount.isZero()

return (
<>
<ModalCard>
<TopSection>
<TopSectionLeft>
<IconOmen id="airdrop" size={38} />
<TopSectionDetails>
<TopSectionHeading>Claimable Amount</TopSectionHeading>
<TopSectionSubHeading green={!claimIsDisabled}>
{bigNumberToString(displayAmount, STANDARD_DECIMALS)} OMN
</TopSectionSubHeading>
</TopSectionDetails>
</TopSectionLeft>
{displayButtons && (
<AirdropButton buttonType={ButtonType.primary} disabled={claimIsDisabled} onClick={submitClaim}>
Claim
</AirdropButton>
)}
</TopSection>
<BottomSection>
<BottomSectionTextWrapper>
{displayButtons ? (
<BottomSectionTextWrapper>
<BottomSectionHeading>Claim OMN token</BottomSectionHeading>
<BottomSectionSubheading>check address for claimable OMN</BottomSectionSubheading>
</BottomSectionTextWrapper>
) : (
<BottomSectionTextWrapper>
<BottomSectionDescription>
Enter an address to trigger a OMN claim. If the address has any claimable OMN it will be sent to them
on submission.
</BottomSectionDescription>
</BottomSectionTextWrapper>
)}
</BottomSectionTextWrapper>
{displayButtons && <AirdropButton onClick={onCheckAddress}>Check</AirdropButton>}
</BottomSection>
</ModalCard>
</>
)
}

export const AirdropCardWrapper = withTheme(AirdropCard)
Loading