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