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

Commit

Permalink
Use cards for claim/receive accounts. (#2312)
Browse files Browse the repository at this point in the history
* Use cards for claim/receive accounts.

* Fix icon light mode.

* Update src/custom/pages/Claim/InvestmentFlow/index.tsx

Co-authored-by: Leandro Boscariol <[email protected]>

* Update src/custom/pages/Claim/InvestmentFlow/index.tsx

Co-authored-by: Leandro Boscariol <[email protected]>

* Update src/custom/pages/Claim/InvestmentFlow/index.tsx

Co-authored-by: Leandro Boscariol <[email protected]>

* Fix mobile styles and isClaimer prop.

* Missing import.

* Update src/custom/pages/Claim/InvestmentFlow/index.tsx

Co-authored-by: Leandro Boscariol <[email protected]>

* Update src/custom/pages/Claim/InvestmentFlow/index.tsx

Co-authored-by: Anxo Rodriguez <[email protected]>

Co-authored-by: Leandro Boscariol <[email protected]>
Co-authored-by: Anxo Rodriguez <[email protected]>
  • Loading branch information
3 people authored Jan 27, 2022
1 parent 13eabc8 commit e6476d9
Show file tree
Hide file tree
Showing 3 changed files with 120 additions and 30 deletions.
6 changes: 6 additions & 0 deletions src/custom/assets/cow-swap/round-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 20 additions & 23 deletions src/custom/pages/Claim/InvestmentFlow/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ import { ClaimCommonTypes, ClaimWithInvestmentData, EnhancedUserClaimData } from
import { COW_LINKS } from 'pages/Claim'
import { ExternalLink } from 'theme'
import { ExplorerLink } from 'components/ExplorerLink'
import { ExplorerDataType } from 'utils/getExplorerLink'

import { BadgeVariant } from 'components/Badge'
import { DollarSign, Icon, Send } from 'react-feather'
import { OperationType } from 'components/TransactionConfirmationModal'
import RoundArrow from 'assets/cow-swap/round-arrow.svg'
import SVG from 'react-inlinesvg'

const STEPS_DATA = [
{
Expand Down Expand Up @@ -102,27 +104,32 @@ function _calculateTotalVCow(allClaims: ClaimWithInvestmentData[]) {
}

type AccountDetailsProps = {
isClaimer?: boolean
label: string
account: string
connectedAccount: string
Icon: Icon
}

function AccountDetails({ label, account, connectedAccount, Icon }: AccountDetailsProps) {
function AccountDetails({ isClaimer, label, account, connectedAccount }: AccountDetailsProps) {
return (
<span>
<b>
<Icon width={14} height={14} /> {label}:
</b>
<i>
<ExplorerLink id={account} label={account} type="address" />{' '}
<div>
{isClaimer && (
<div>
<SVG src={RoundArrow} description="Arrow" />
</div>
)}
<span>
<b>{label}</b>
<i>
<ExplorerLink id={account} label={account} type={ExplorerDataType.ADDRESS} />
</i>
{account === connectedAccount ? (
<Badge variant={BadgeVariant.POSITIVE}>&nbsp; Connected account</Badge>
) : (
<Badge variant={BadgeVariant.WARNING}>&nbsp; External account</Badge>
)}
</i>
</span>
</span>
</div>
)
}

Expand Down Expand Up @@ -249,18 +256,8 @@ export default function InvestmentFlow({ hasClaims, isAirdropOnly, modalCbs }: I
</ClaimTable>

<AccountClaimSummary>
<AccountDetails
label="Claiming with account"
account={account}
connectedAccount={account}
Icon={DollarSign}
/>
<AccountDetails
label="Receiving account"
account={activeClaimAccount}
connectedAccount={account}
Icon={Send}
/>
<AccountDetails isClaimer label="Claiming with" account={account} connectedAccount={account} />
<AccountDetails label="Receiving on" account={activeClaimAccount} connectedAccount={account} />
</AccountClaimSummary>

<h4>Ready to claim your vCOW?</h4>
Expand Down
101 changes: 94 additions & 7 deletions src/custom/pages/Claim/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export const ClaimTable = styled.div`
display: flex;
flex-flow: column wrap;
width: 100%;
margin: 0 0 24px;
margin: 0;
${TokenLogo},
${Icon} {
Expand Down Expand Up @@ -1241,6 +1241,7 @@ export const InvestInput = styled.span<{ disabled: boolean }>`
cursor: pointer;
color: ${({ theme }) => theme.primary4};
text-decoration: underline;
margin: 0 0 0 5px;
${({ theme }) => theme.mediaWidth.upToSmall`
margin: 0;
Expand Down Expand Up @@ -1362,25 +1363,111 @@ export const ClaimAccountButtons = styled.div`

export const AccountClaimSummary = styled.div`
display: flex;
flex-flow: row wrap;
flex-flow: row;
gap: 12px;
margin: 24px 0;
margin: 0 0 12px;
position: relative;
> span {
display: flex;
${({ theme }) => theme.mediaWidth.upToSmall`
flex-flow: column wrap;
`};
> div {
display: flex;
white-space: pre-wrap;
gap: 3px;
padding: 24px;
background: ${({ theme }) => theme.blueShade3};
border-radius: 12px;
flex: 0 1 50%;
color: inherit;
&:first-of-type {
padding-right: 32px;
${({ theme }) => theme.mediaWidth.upToSmall`
padding: 24px 24px 32px 24px;
`};
}
&:last-of-type {
padding-left: 32px;
${({ theme }) => theme.mediaWidth.upToSmall`
padding: 32px 24px 24px 24px;
`};
}
}
> span > i {
> div > span {
display: flex;
flex-flow: column wrap;
color: inherit;
gap: 9px 0;
}
> div > span > b {
font-size: 15px;
font-weight: 400;
opacity: 0.7;
margin: 0;
}
> div > span > i {
font-style: normal;
word-break: break-all;
font-size: 18px;
color: inherit;
margin: 0 0 5px;
> a {
color: inherit;
}
> a::after {
content: '↗';
display: inline;
margin: 0 0 0 3px;
font-size: 14px;
}
}
> div > div {
--iconSize: 42px;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
margin: auto;
border-radius: var(--iconSize);
width: var(--iconSize);
height: var(--iconSize);
background: ${({ theme }) => theme.bg1};
${({ theme }) => theme.mediaWidth.upToSmall`
transform: rotate(90deg);
`};
> svg {
width: 100%;
height: 100%;
padding: 8px;
}
> svg > path {
fill: ${({ theme }) => theme.text1};
}
}
`

export const Badge = styled(BadgeOriginal)`
font-size: 11px;
font-size: 12px;
text-align: center;
border-radius: 12px;
`

export const CowSpinner = styled.div`
Expand Down

0 comments on commit e6476d9

Please sign in to comment.