Skip to content

Commit

Permalink
Merge pull request #184 from AstraProtocol/fix/add-whitelist-label-ad…
Browse files Browse the repository at this point in the history
…dress-in-homepage

fix: add whitelist label address in homepage
  • Loading branch information
Tien Dao committed Sep 6, 2023
2 parents c5d0d36 + cf42a53 commit 50b1034
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions views/transactions/TransactionBriefRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import Tag from 'components/Tag/PolygonTag'
import Timer from 'components/Timer'
import Typography from 'components/Typography'
import Image from 'next/image'
import { useMemo } from 'react'
import { CONFIG } from 'utils/constants'
import { TransactionTypeEnum } from 'utils/enum'
import { ellipseBetweenText, LinkMaker } from 'utils/helper'
import { getAddressLabel } from 'utils/label'
import styles from './style.module.scss'

type TransactionBriefRowProps = {
Expand Down Expand Up @@ -44,6 +46,9 @@ export default function TransactionBriefRow({
const transactionQuery = isEvm ? { type: 'evm' } : null
const length = isMobile ? CONFIG.TXS_MOBILE_SPLIT_LENGTH : CONFIG.TXS_DESKTOP_SPLIT_LENGTH

const fromAddressLabel = useMemo(() => getAddressLabel('', from), [from])
const toAddressLabel = useMemo(() => getAddressLabel('', to), [to])

return (
<RowShowAnimation action={newTransaction}>
<div
Expand Down Expand Up @@ -94,7 +99,9 @@ export default function TransactionBriefRow({
fontSize="money-2xs"
classes="margin-right-sm"
>
{ellipseBetweenText(from, 6, 6)}
{fromAddressLabel
? fromAddressLabel
: ellipseBetweenText(from, 6, 6)}
</Typography.LinkText>
</>
)}
Expand All @@ -112,7 +119,7 @@ export default function TransactionBriefRow({
href={LinkMaker.address(to)}
fontSize="money-2xs"
>
{ellipseBetweenText(to, 6, 6)}
{toAddressLabel ? toAddressLabel : ellipseBetweenText(to, 6, 6)}
</Typography.LinkText>
</>
)}
Expand Down

0 comments on commit 50b1034

Please sign in to comment.