From 26a8e5bea2a7e1b662e665ee8c822a087f0bc74f Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 19 Jul 2021 13:01:15 -0300 Subject: [PATCH 1/5] Lower opacity of self-destruct addresses --- src/components/DecoratedAddressLink.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/DecoratedAddressLink.tsx b/src/components/DecoratedAddressLink.tsx index 9dcd416..7fb76f7 100644 --- a/src/components/DecoratedAddressLink.tsx +++ b/src/components/DecoratedAddressLink.tsx @@ -35,7 +35,7 @@ const DecoratedAddresssLink: React.FC = ({ 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" : "" + selfDestruct ? "line-through opacity-70 hover:opacity-100" : "" }`} > {mint && ( From 00cc2d0d29ce229cd8c88f6f357d1223abb6db75 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 19 Jul 2021 13:29:49 -0300 Subject: [PATCH 2/5] Add contextual global tx from/to addresss highlighting --- src/TokenTransferItem.tsx | 18 ++++++++++++++++-- src/components/DecoratedAddressLink.tsx | 14 +++++++++----- src/components/InternalTransfer.tsx | 14 ++++++++++++-- src/transaction/Details.tsx | 9 ++++++++- src/useSelection.ts | 2 +- 5 files changed, 46 insertions(+), 11 deletions(-) diff --git a/src/TokenTransferItem.tsx b/src/TokenTransferItem.tsx index 286d43f..1e171de 100644 --- a/src/TokenTransferItem.tsx +++ b/src/TokenTransferItem.tsx @@ -5,15 +5,22 @@ 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 = ({ t, + txData, tokenMetas, }) => (
@@ -27,13 +34,20 @@ const TokenTransferItem: React.FC = ({
To - +
diff --git a/src/components/DecoratedAddressLink.tsx b/src/components/DecoratedAddressLink.tsx index 7fb76f7..f82c7a4 100644 --- a/src/components/DecoratedAddressLink.tsx +++ b/src/components/DecoratedAddressLink.tsx @@ -16,6 +16,8 @@ type DecoratedAddressLinkProps = { addressCtx?: AddressContext; miner?: boolean; selfDestruct?: boolean; + txFrom?: boolean; + txTo?: boolean; }; const DecoratedAddresssLink: React.FC = ({ @@ -26,17 +28,19 @@ const DecoratedAddresssLink: React.FC = ({ addressCtx, miner, selfDestruct, + txFrom, + txTo, }) => { const mint = addressCtx === AddressContext.FROM && address === ZERO_ADDRESS; const burn = addressCtx === AddressContext.TO && address === ZERO_ADDRESS; return (
{mint && ( diff --git a/src/components/InternalTransfer.tsx b/src/components/InternalTransfer.tsx index af101e0..d0ccbf2 100644 --- a/src/components/InternalTransfer.tsx +++ b/src/components/InternalTransfer.tsx @@ -33,7 +33,12 @@ const InternalTransfer: React.FC = ({ fromMiner ? "rounded px-2 py-1 bg-yellow-100" : "" }`} > - +
@@ -45,7 +50,12 @@ const InternalTransfer: React.FC = ({ toMiner ? "rounded px-2 py-1 bg-yellow-100" : "" }`} > - + diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 441226a..cba7a9a 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -68,6 +68,7 @@ const Details: React.FC = ({ @@ -79,6 +80,7 @@ const Details: React.FC = ({ @@ -101,7 +103,12 @@ const Details: React.FC = ({
{txData.tokenTransfers.map((t, i) => ( - + ))}
diff --git a/src/useSelection.ts b/src/useSelection.ts index ed66746..a02f1fe 100644 --- a/src/useSelection.ts +++ b/src/useSelection.ts @@ -1,7 +1,7 @@ import React, { useState, useContext } from "react"; export type Selection = { - type: string; + type: "address"; content: string; }; From 2aa6298fdf926662921618fcc2a1658e15b17a58 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 19 Jul 2021 14:47:14 -0300 Subject: [PATCH 3/5] Use decorated addresss component on logs section --- src/transaction/Logs.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/transaction/Logs.tsx b/src/transaction/Logs.tsx index bf101fb..f965ecc 100644 --- a/src/transaction/Logs.tsx +++ b/src/transaction/Logs.tsx @@ -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 = ({ txData }) => (
Address
- +
{l.topics.map((t, i) => ( From 83af14259b8e407e7b1b5b22d172346049070ff2 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Mon, 19 Jul 2021 14:56:36 -0300 Subject: [PATCH 4/5] Push token decoration into DecoratedAddressLink component --- src/TokenTransferItem.tsx | 27 +++++++++---------------- src/components/DecoratedAddressLink.tsx | 10 ++++++++- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/TokenTransferItem.tsx b/src/TokenTransferItem.tsx index 1e171de..c8d51c8 100644 --- a/src/TokenTransferItem.tsx +++ b/src/TokenTransferItem.tsx @@ -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 = ({ decimals={tokenMetas[t.token].decimals} /> - - {tokenMetas[t.token] ? ( - <> -
- -
- - - ) : ( - - )} -
+ diff --git a/src/components/DecoratedAddressLink.tsx b/src/components/DecoratedAddressLink.tsx index f82c7a4..6d58bf5 100644 --- a/src/components/DecoratedAddressLink.tsx +++ b/src/components/DecoratedAddressLink.tsx @@ -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 = ({ @@ -30,6 +32,7 @@ const DecoratedAddresssLink: React.FC = ({ 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 = ({ )} + {tokenMeta && ( +
+ +
+ )} Date: Mon, 19 Jul 2021 15:00:15 -0300 Subject: [PATCH 5/5] Apply address highlighting to token names --- src/TokenTransferItem.tsx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/TokenTransferItem.tsx b/src/TokenTransferItem.tsx index c8d51c8..83c5e81 100644 --- a/src/TokenTransferItem.tsx +++ b/src/TokenTransferItem.tsx @@ -57,15 +57,17 @@ const TokenTransferItem: React.FC = ({ decimals={tokenMetas[t.token].decimals} /> - + + +