2021-07-03 00:40:02 +00:00
|
|
|
import React from "react";
|
2021-07-05 23:55:07 +00:00
|
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
|
|
import { faCoins } from "@fortawesome/free-solid-svg-icons";
|
2021-07-03 00:40:02 +00:00
|
|
|
import Address from "./Address";
|
|
|
|
import AddressLink from "./AddressLink";
|
|
|
|
import ENSName from "./ENSName";
|
|
|
|
import ENSNameLink from "./ENSNameLink";
|
|
|
|
|
|
|
|
type AddressOrENSNameProps = {
|
|
|
|
address: string;
|
|
|
|
ensName?: string;
|
|
|
|
selectedAddress?: string;
|
2021-07-05 23:55:07 +00:00
|
|
|
minerAddress?: string;
|
2021-07-03 00:40:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const AddressOrENSName: React.FC<AddressOrENSNameProps> = ({
|
|
|
|
address,
|
|
|
|
ensName,
|
|
|
|
selectedAddress,
|
2021-07-05 23:55:07 +00:00
|
|
|
minerAddress,
|
|
|
|
}) => (
|
2021-07-06 00:12:16 +00:00
|
|
|
<div className="flex items-baseline space-x-1 truncate">
|
2021-07-05 23:55:07 +00:00
|
|
|
{minerAddress !== undefined && minerAddress === address && (
|
|
|
|
<span className="text-yellow-400" title="Miner address">
|
|
|
|
<FontAwesomeIcon icon={faCoins} size="1x" />
|
|
|
|
</span>
|
|
|
|
)}
|
|
|
|
{address === selectedAddress ? (
|
|
|
|
<>
|
|
|
|
{ensName ? (
|
|
|
|
<ENSName name={ensName} address={address} />
|
|
|
|
) : (
|
|
|
|
<Address address={address} />
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
{ensName ? (
|
|
|
|
<ENSNameLink name={ensName} address={address} />
|
|
|
|
) : (
|
|
|
|
<AddressLink address={address} />
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
);
|
2021-07-03 00:40:02 +00:00
|
|
|
|
|
|
|
export default React.memo(AddressOrENSName);
|