2021-07-19 03:38:38 +00:00
|
|
|
import React from "react";
|
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import {
|
|
|
|
faMoneyBillAlt,
|
|
|
|
faBurn,
|
|
|
|
faCoins,
|
|
|
|
} from "@fortawesome/free-solid-svg-icons";
|
|
|
|
import AddressOrENSName from "./AddressOrENSName";
|
|
|
|
import { AddressContext, ZERO_ADDRESS } from "../types";
|
|
|
|
|
|
|
|
type DecoratedAddressLinkProps = {
|
|
|
|
address: string;
|
|
|
|
ensName?: string;
|
|
|
|
selectedAddress?: string;
|
|
|
|
text?: string;
|
|
|
|
addressCtx?: AddressContext;
|
|
|
|
miner?: boolean;
|
2021-07-19 07:19:24 +00:00
|
|
|
selfDestruct?: boolean;
|
2021-07-19 16:29:49 +00:00
|
|
|
txFrom?: boolean;
|
|
|
|
txTo?: boolean;
|
2021-07-19 03:38:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const DecoratedAddresssLink: React.FC<DecoratedAddressLinkProps> = ({
|
|
|
|
address,
|
|
|
|
ensName,
|
|
|
|
selectedAddress,
|
|
|
|
text,
|
|
|
|
addressCtx,
|
|
|
|
miner,
|
2021-07-19 07:19:24 +00:00
|
|
|
selfDestruct,
|
2021-07-19 16:29:49 +00:00
|
|
|
txFrom,
|
|
|
|
txTo,
|
2021-07-19 03:38:38 +00:00
|
|
|
}) => {
|
|
|
|
const mint = addressCtx === AddressContext.FROM && address === ZERO_ADDRESS;
|
|
|
|
const burn = addressCtx === AddressContext.TO && address === ZERO_ADDRESS;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div
|
2021-07-19 16:29:49 +00:00
|
|
|
className={`flex items-baseline space-x-1 ${txFrom ? "bg-red-50" : ""} ${
|
|
|
|
txTo ? "bg-green-50" : ""
|
|
|
|
} ${mint ? "italic text-green-500 hover:text-green-700" : ""} ${
|
|
|
|
burn ? "line-through text-orange-500 hover:text-orange-700" : ""
|
|
|
|
} ${selfDestruct ? "line-through opacity-70 hover:opacity-100" : ""}`}
|
2021-07-19 03:38:38 +00:00
|
|
|
>
|
|
|
|
{mint && (
|
|
|
|
<span className="text-green-500" title="Mint address">
|
|
|
|
<FontAwesomeIcon icon={faMoneyBillAlt} size="1x" />
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
{burn && (
|
|
|
|
<span className="text-orange-500" title="Burn address">
|
|
|
|
<FontAwesomeIcon icon={faBurn} size="1x" />
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
{miner && (
|
|
|
|
<span className="text-yellow-400" title="Miner address">
|
|
|
|
<FontAwesomeIcon icon={faCoins} size="1x" />
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
<AddressOrENSName
|
|
|
|
address={address}
|
|
|
|
ensName={ensName}
|
|
|
|
selectedAddress={selectedAddress}
|
|
|
|
text={text}
|
2021-07-19 03:50:32 +00:00
|
|
|
dontOverrideColors={mint || burn}
|
2021-07-19 03:38:38 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default React.memo(DecoratedAddresssLink);
|