Merge branch 'feature/ui-tweaks' into feature/self-destruct-trace
This commit is contained in:
commit
590ffd60dc
|
@ -3,17 +3,23 @@ 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, TokenMetas, TokenTransfer } from "./types";
|
||||
import {
|
||||
AddressContext,
|
||||
TokenMetas,
|
||||
TokenTransfer,
|
||||
TransactionData,
|
||||
} from "./types";
|
||||
|
||||
type TokenTransferItemProps = {
|
||||
t: TokenTransfer;
|
||||
txData: TransactionData;
|
||||
tokenMetas: TokenMetas;
|
||||
};
|
||||
|
||||
const TokenTransferItem: React.FC<TokenTransferItemProps> = ({
|
||||
t,
|
||||
txData,
|
||||
tokenMetas,
|
||||
}) => (
|
||||
<div className="flex items-baseline space-x-2 px-2 py-1 truncate hover:bg-gray-100">
|
||||
|
@ -27,13 +33,20 @@ const TokenTransferItem: React.FC<TokenTransferItemProps> = ({
|
|||
<DecoratedAddressLink
|
||||
address={t.from}
|
||||
addressCtx={AddressContext.FROM}
|
||||
txFrom={t.from === txData.from}
|
||||
txTo={t.from === txData.to}
|
||||
/>
|
||||
</AddressHighlighter>
|
||||
</div>
|
||||
<div className="flex space-x-1">
|
||||
<span className="font-bold">To</span>
|
||||
<AddressHighlighter address={t.to}>
|
||||
<DecoratedAddressLink address={t.to} addressCtx={AddressContext.TO} />
|
||||
<DecoratedAddressLink
|
||||
address={t.to}
|
||||
addressCtx={AddressContext.TO}
|
||||
txFrom={t.to === txData.from}
|
||||
txTo={t.to === txData.to}
|
||||
/>
|
||||
</AddressHighlighter>
|
||||
</div>
|
||||
<div className="col-span-3 flex space-x-1">
|
||||
|
@ -44,23 +57,17 @@ 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>
|
||||
<AddressHighlighter address={t.token}>
|
||||
<DecoratedAddressLink
|
||||
address={t.token}
|
||||
text={`${tokenMetas[t.token].name} (${
|
||||
tokenMetas[t.token].symbol
|
||||
})`}
|
||||
text={
|
||||
tokenMetas[t.token]
|
||||
? `${tokenMetas[t.token].name} (${tokenMetas[t.token].symbol})`
|
||||
: ""
|
||||
}
|
||||
tokenMeta={tokenMetas[t.token]}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<DecoratedAddressLink address={t.token} />
|
||||
)}
|
||||
</span>
|
||||
</AddressHighlighter>
|
||||
</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;
|
||||
|
@ -16,6 +17,9 @@ type DecoratedAddressLinkProps = {
|
|||
addressCtx?: AddressContext;
|
||||
miner?: boolean;
|
||||
selfDestruct?: boolean;
|
||||
txFrom?: boolean;
|
||||
txTo?: boolean;
|
||||
tokenMeta?: TokenMeta;
|
||||
};
|
||||
|
||||
const DecoratedAddresssLink: React.FC<DecoratedAddressLinkProps> = ({
|
||||
|
@ -26,17 +30,20 @@ const DecoratedAddresssLink: React.FC<DecoratedAddressLinkProps> = ({
|
|||
addressCtx,
|
||||
miner,
|
||||
selfDestruct,
|
||||
txFrom,
|
||||
txTo,
|
||||
tokenMeta,
|
||||
}) => {
|
||||
const mint = addressCtx === AddressContext.FROM && address === ZERO_ADDRESS;
|
||||
const burn = addressCtx === AddressContext.TO && address === ZERO_ADDRESS;
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`flex items-baseline space-x-1 ${
|
||||
mint ? "italic text-green-500 hover:text-green-700" : ""
|
||||
} ${burn ? "line-through text-orange-500 hover:text-orange-700" : ""} ${
|
||||
selfDestruct ? "line-through" : ""
|
||||
}`}
|
||||
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" : ""}`}
|
||||
>
|
||||
{mint && (
|
||||
<span className="text-green-500" title="Mint address">
|
||||
|
@ -53,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}
|
||||
|
|
|
@ -33,7 +33,12 @@ const InternalTransfer: React.FC<InternalTransferProps> = ({
|
|||
fromMiner ? "rounded px-2 py-1 bg-yellow-100" : ""
|
||||
}`}
|
||||
>
|
||||
<DecoratedAddressLink address={transfer.from} miner={fromMiner} />
|
||||
<DecoratedAddressLink
|
||||
address={transfer.from}
|
||||
miner={fromMiner}
|
||||
txFrom={transfer.from === txData.from}
|
||||
txTo={transfer.from === txData.to}
|
||||
/>
|
||||
</div>
|
||||
</AddressHighlighter>
|
||||
</div>
|
||||
|
@ -45,7 +50,12 @@ const InternalTransfer: React.FC<InternalTransferProps> = ({
|
|||
toMiner ? "rounded px-2 py-1 bg-yellow-100" : ""
|
||||
}`}
|
||||
>
|
||||
<DecoratedAddressLink address={transfer.to} miner={toMiner} />
|
||||
<DecoratedAddressLink
|
||||
address={transfer.to}
|
||||
miner={toMiner}
|
||||
txFrom={transfer.to === txData.from}
|
||||
txTo={transfer.to === txData.to}
|
||||
/>
|
||||
</div>
|
||||
</AddressHighlighter>
|
||||
</div>
|
||||
|
|
|
@ -68,6 +68,7 @@ const Details: React.FC<DetailsProps> = ({
|
|||
<DecoratedAddressLink
|
||||
address={txData.from}
|
||||
miner={txData.from === txData.miner}
|
||||
txFrom
|
||||
/>
|
||||
</AddressHighlighter>
|
||||
<Copy value={txData.from} />
|
||||
|
@ -79,6 +80,7 @@ const Details: React.FC<DetailsProps> = ({
|
|||
<DecoratedAddressLink
|
||||
address={txData.to}
|
||||
miner={txData.to === txData.miner}
|
||||
txTo
|
||||
/>
|
||||
</AddressHighlighter>
|
||||
<Copy value={txData.to} />
|
||||
|
@ -101,7 +103,12 @@ const Details: React.FC<DetailsProps> = ({
|
|||
<InfoRow title={`Tokens Transferred (${txData.tokenTransfers.length})`}>
|
||||
<div>
|
||||
{txData.tokenTransfers.map((t, i) => (
|
||||
<TokenTransferItem key={i} t={t} tokenMetas={txData.tokenMetas} />
|
||||
<TokenTransferItem
|
||||
key={i}
|
||||
t={t}
|
||||
txData={txData}
|
||||
tokenMetas={txData.tokenMetas}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</InfoRow>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from "react";
|
||||
import ContentFrame from "../ContentFrame";
|
||||
import AddressOrENSName from "../components/AddressOrENSName";
|
||||
import DecoratedAddressLink from "../components/DecoratedAddressLink";
|
||||
import { TransactionData } from "../types";
|
||||
|
||||
type LogsProps = {
|
||||
|
@ -22,7 +22,12 @@ const Logs: React.FC<LogsProps> = ({ txData }) => (
|
|||
<div className="grid grid-cols-12 gap-x-3 gap-y-5 text-sm">
|
||||
<div className="font-bold text-right">Address</div>
|
||||
<div className="col-span-11">
|
||||
<AddressOrENSName address={l.address} />
|
||||
<DecoratedAddressLink
|
||||
address={l.address}
|
||||
miner={l.address === txData.miner}
|
||||
txFrom={l.address === txData.from}
|
||||
txTo={l.address === txData.to}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{l.topics.map((t, i) => (
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import React, { useState, useContext } from "react";
|
||||
|
||||
export type Selection = {
|
||||
type: string;
|
||||
type: "address";
|
||||
content: string;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue