Skip to content

Commit

Permalink
Displaying the ended ANT to ETH redemption (#111)
Browse files Browse the repository at this point in the history
* Ending ANT to ETH redemption

* Minor change

* Allowing to archive the build

* Final touches
  • Loading branch information
brickpop authored Nov 3, 2024
1 parent a5dbe63 commit 8dae2d6
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 133 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/archive.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on: push
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install node
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build ANT Redemption Portal
run: yarn build
- name: Run BundleWatch
run: yarn bundlewatch
- name: Run tests
run: yarn test
- name: Archive build
uses: actions/upload-artifact@v4
with:
name: ant-portal
path: build/
retention-days: 1

env:
CI: true
BUNDLEWATCH_GITHUB_TOKEN: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
140 changes: 27 additions & 113 deletions src/components/GetStarted/AntV2EthConversionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,24 @@ import {
useLayout,
// @ts-ignore
} from '@aragon/ui'
import { useHistory } from 'react-router-dom'
import TokenGraphic from '../TokenGraphic/TokenGraphic'
import BrandButton from '../BrandButton/BrandButton'
import { BalanceItem } from './BalanceCard'
import { radius } from '../../style/radius'
import { fontWeight } from '../../style/font'
import { TokenName } from '../../token-info/types'
import { tokenInfo } from '../../token-info/tokenInfo'
import rightArrowPng from '../../assets/right-arrow.png'
import LockIcon from '../icons/LockIcon'
import { REDEEM_ANTV2_PATH } from '../../Routes'
import useAntV2ToEthRate from '../../hooks/useAntV2ToEthRate'
import { theme as localTheme } from '../../style/theme'

type AntV2EthConversionCardProps = {
balance: string | null
accountConnected: boolean
available?: boolean
}

function AntV2EthConversionCard({
balance: antBalance,
accountConnected,
available = true,
}: AntV2EthConversionCardProps): JSX.Element {
function AntV2EthConversionCard(): JSX.Element {
const available = false
const tokenName: TokenName = 'antV2'

const theme = useTheme()
const history = useHistory()
const { layoutName } = useLayout()
const antV2ToEthRate = useAntV2ToEthRate()

const compactMode = layoutName === 'small'
const tabletMobileMode = layoutName === 'small' || layoutName === 'medium'

const tokenTitle = tokenInfo[tokenName].suffix

Expand Down Expand Up @@ -91,14 +75,16 @@ function AntV2EthConversionCard({
>
For ANTv2 Holders
</div>
<div
css={`
display: flex;
align-items: center;
`}
>
ETH/ANTv2: {antV2ToEthRate}
</div>
{antV2ToEthRate && (
<div
css={`
display: flex;
align-items: center;
`}
>
ETH/ANTv2: {antV2ToEthRate}
</div>
)}
</div>
<div
css={`
Expand Down Expand Up @@ -159,95 +145,23 @@ function AntV2EthConversionCard({
{tokenTitle} to ETH
</h3>
</div>
{available ? (
<div
css={`
padding-top: ${2 * GU}px;
`}
>
<BrandButton
mode="strong"
size="large"
wide
disabled={!antBalance || antBalance === '0'}
onClick={() => {
history.push(REDEEM_ANTV2_PATH)
}}
label="Start now"
/>
</div>
) : (
<div
css={`
padding-top: ${2 * GU}px;
width: 100%;
height: 100%;
`}
>
<BrandButton
icon={<LockIcon />}
mode="strong"
size="large"
wide
disabled={true}
label="Please, ensure that you are connected to Ethereum mainnet"
css={`
width: 100%;
height: ${14.75 * GU}px;
`}
/>
</div>
)}
</div>
</div>
{available && (
<div
css={`
font-size: 18px;
line-height: 1;
`}
>
{accountConnected ? (
<ul
css={`
${!tabletMobileMode &&
`& > * {
max-width: 400px;
margin-left: auto;
margin-bottom: ${1.5 * GU}px;
}`}
`}
>
<BalanceItem
title={
<span>
Redeemable{' '}
<span
css={`
font-weight: bold;
`}
>
{tokenTitle}
</span>{' '}
balance
</span>
}
amount={antBalance}
compactMode={compactMode}
tokenName={tokenName}
/>
</ul>
) : (
<p
css={`
color: ${localTheme.secondary};
`}
>
Enable account to see your balance

<div
css={`
padding-top: ${2 * GU}px;
width: 100%;
height: 100%;
text-align: center;
`}
>
<p>
The ANT Redemption Initiative ended on November 2nd 2024 23:59
UTC. <br />
For any questions, please reach out to [email protected]
</p>
)}
</div>
</div>
)}
</div>
</div>
)
}
Expand Down
22 changes: 2 additions & 20 deletions src/components/GetStarted/Balances.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { bigNum } from '../../utils/math-utils'
import { useWallet } from '../../providers/Wallet'
import { networkEnvironment } from '../../environment'
import { CONVERSION_RATE } from '../Migrate/conversionUtils'
import useRedemptionEthBalance from '../../hooks/useRedemptionEthBalance'

const { chainId } = networkEnvironment

Expand All @@ -24,21 +23,8 @@ function Balances({
const { account } = useWallet()
const [modalVisible, setModalVisible] = useState(false)
const { layoutName } = useLayout()
const { antV2, antV1, anj, lpBalances } = useAccountBalances()
const { antV1, anj, lpBalances } = useAccountBalances()
const stackedCards = layoutName === 'small' || layoutName === 'medium'
const antV2RedeemContractBalance = useRedemptionEthBalance()
const antV2RedeemContractHasBalance = Boolean(
antV2RedeemContractBalance && antV2RedeemContractBalance > 0
)

const formattedAntV2Balance = useMemo(
(): string | null =>
antV2.balance &&
new TokenAmount(antV2.balance, antV2.decimals).format({
digits: FORMATTED_DIGITS,
}),
[antV2.balance, antV2.decimals]
)

const formattedAntV1Balance = useMemo(
(): string | null =>
Expand Down Expand Up @@ -97,11 +83,7 @@ function Balances({
}`}
`}
>
<AntV2EthConversionCard
balance={formattedAntV2Balance}
accountConnected={accountConnected}
available={antV2RedeemContractHasBalance}
/>
<AntV2EthConversionCard />
<TokenConversionCard
tokenName="anj"
balance={formattedAnjBalance}
Expand Down

0 comments on commit 8dae2d6

Please sign in to comment.