Push token decoration into DecoratedAddressLink component
This commit is contained in:
parent
2aa6298fdf
commit
83af14259b
|
@ -3,7 +3,6 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|||
import { faCaretRight } from "@fortawesome/free-solid-svg-icons";
|
||||
import AddressHighlighter from "./components/AddressHighlighter";
|
||||
import DecoratedAddressLink from "./components/DecoratedAddressLink";
|
||||
import TokenLogo from "./components/TokenLogo";
|
||||
import FormattedBalance from "./components/FormattedBalance";
|
||||
import {
|
||||
AddressContext,
|
||||
|
@ -58,23 +57,15 @@ const TokenTransferItem: React.FC<TokenTransferItemProps> = ({
|
|||
decimals={tokenMetas[t.token].decimals}
|
||||
/>
|
||||
</span>
|
||||
<span className="flex space-x-1 items-baseline truncate">
|
||||
{tokenMetas[t.token] ? (
|
||||
<>
|
||||
<div className="self-center">
|
||||
<TokenLogo address={t.token} name={tokenMetas[t.token].name} />
|
||||
</div>
|
||||
<DecoratedAddressLink
|
||||
address={t.token}
|
||||
text={`${tokenMetas[t.token].name} (${
|
||||
tokenMetas[t.token].symbol
|
||||
})`}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<DecoratedAddressLink address={t.token} />
|
||||
)}
|
||||
</span>
|
||||
<DecoratedAddressLink
|
||||
address={t.token}
|
||||
text={
|
||||
tokenMetas[t.token]
|
||||
? `${tokenMetas[t.token].name} (${tokenMetas[t.token].symbol})`
|
||||
: ""
|
||||
}
|
||||
tokenMeta={tokenMetas[t.token]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,8 +5,9 @@ import {
|
|||
faBurn,
|
||||
faCoins,
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
import TokenLogo from "./TokenLogo";
|
||||
import AddressOrENSName from "./AddressOrENSName";
|
||||
import { AddressContext, ZERO_ADDRESS } from "../types";
|
||||
import { AddressContext, TokenMeta, ZERO_ADDRESS } from "../types";
|
||||
|
||||
type DecoratedAddressLinkProps = {
|
||||
address: string;
|
||||
|
@ -18,6 +19,7 @@ type DecoratedAddressLinkProps = {
|
|||
selfDestruct?: boolean;
|
||||
txFrom?: boolean;
|
||||
txTo?: boolean;
|
||||
tokenMeta?: TokenMeta;
|
||||
};
|
||||
|
||||
const DecoratedAddresssLink: React.FC<DecoratedAddressLinkProps> = ({
|
||||
|
@ -30,6 +32,7 @@ const DecoratedAddresssLink: React.FC<DecoratedAddressLinkProps> = ({
|
|||
selfDestruct,
|
||||
txFrom,
|
||||
txTo,
|
||||
tokenMeta,
|
||||
}) => {
|
||||
const mint = addressCtx === AddressContext.FROM && address === ZERO_ADDRESS;
|
||||
const burn = addressCtx === AddressContext.TO && address === ZERO_ADDRESS;
|
||||
|
@ -57,6 +60,11 @@ const DecoratedAddresssLink: React.FC<DecoratedAddressLinkProps> = ({
|
|||
<FontAwesomeIcon icon={faCoins} size="1x" />
|
||||
</span>
|
||||
)}
|
||||
{tokenMeta && (
|
||||
<div className="self-center">
|
||||
<TokenLogo address={address} name={tokenMeta.name} />
|
||||
</div>
|
||||
)}
|
||||
<AddressOrENSName
|
||||
address={address}
|
||||
ensName={ensName}
|
||||
|
|
Loading…
Reference in New Issue