Skip to content

Commit

Permalink
Ending ANT to ETH redemption
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Nov 1, 2024
1 parent a5dbe63 commit 9e85ddd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 120 deletions.
121 changes: 21 additions & 100 deletions src/components/GetStarted/AntV2EthConversionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,27 @@ 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 tabletMobileMode = layoutName === 'small' || layoutName === 'medium'

const tokenTitle = tokenInfo[tokenName].suffix

Expand Down Expand Up @@ -159,95 +146,29 @@ 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

<div
css={`
padding-top: ${2 * GU}px;
width: 100%;
height: 100%;
`}
>
<BrandButton
icon={<LockIcon />}
mode="strong"
size="large"
wide
disabled={true}
label="The ANT Redemption Initiative ended on November 2nd 2024 23:59 UTC. For any questions, please reach out to [email protected]"
css={`
padding-top: ${2 * GU}px;
width: 100%;
height: 100%;
height: ${14.75 * GU}px;
`}
>
<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>
</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
</p>
)}
</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 9e85ddd

Please sign in to comment.