Remove unnecessary parameter

This commit is contained in:
Willian Mitsuda 2022-03-25 21:40:54 -03:00
parent 4b85cc8cd5
commit 247596e58a
3 changed files with 14 additions and 26 deletions

View File

@ -24,12 +24,7 @@ const Trace: React.FC<TraceProps> = ({ txData }) => {
</div> </div>
<div className="ml-5 space-y-3 self-stretch"> <div className="ml-5 space-y-3 self-stretch">
{traces.map((t, i, a) => ( {traces.map((t, i, a) => (
<TraceItem <TraceItem key={i} t={t} last={i === a.length - 1} />
key={i}
t={t}
last={i === a.length - 1}
txData={txData}
/>
))} ))}
</div> </div>
</> </>

View File

@ -13,14 +13,12 @@ import {
useTransactionDescription, useTransactionDescription,
} from "../use4Bytes"; } from "../use4Bytes";
import { useChainInfo } from "../useChainInfo"; import { useChainInfo } from "../useChainInfo";
import { TransactionData } from "../types";
type TraceInputProps = { type TraceInputProps = {
t: TraceEntry; t: TraceEntry;
txData: TransactionData;
}; };
const TraceInput: React.FC<TraceInputProps> = ({ t, txData }) => { const TraceInput: React.FC<TraceInputProps> = ({ t }) => {
const { nativeSymbol } = useChainInfo(); const { nativeSymbol } = useChainInfo();
const raw4Bytes = extract4Bytes(t.input); const raw4Bytes = extract4Bytes(t.input);
const fourBytes = use4Bytes(raw4Bytes); const fourBytes = use4Bytes(raw4Bytes);

View File

@ -5,15 +5,13 @@ import { faMinusSquare } from "@fortawesome/free-regular-svg-icons/faMinusSquare
import { Switch } from "@headlessui/react"; import { Switch } from "@headlessui/react";
import { TraceGroup } from "../useErigonHooks"; import { TraceGroup } from "../useErigonHooks";
import TraceInput from "./TraceInput"; import TraceInput from "./TraceInput";
import { TransactionData } from "../types";
type TraceItemProps = { type TraceItemProps = {
t: TraceGroup; t: TraceGroup;
last: boolean; last: boolean;
txData: TransactionData;
}; };
const TraceItem: React.FC<TraceItemProps> = ({ t, last, txData }) => { const TraceItem: React.FC<TraceItemProps> = ({ t, last }) => {
const [expanded, setExpanded] = useState<boolean>(true); const [expanded, setExpanded] = useState<boolean>(true);
return ( return (
@ -35,7 +33,7 @@ const TraceItem: React.FC<TraceItemProps> = ({ t, last, txData }) => {
/> />
</Switch> </Switch>
)} )}
<TraceInput t={t} txData={txData} /> <TraceInput t={t} />
</div> </div>
{t.children && ( {t.children && (
<div <div
@ -43,7 +41,7 @@ const TraceItem: React.FC<TraceItemProps> = ({ t, last, txData }) => {
expanded ? "" : "hidden" expanded ? "" : "hidden"
}`} }`}
> >
<TraceChildren c={t.children} txData={txData} /> <TraceChildren c={t.children} />
</div> </div>
)} )}
</> </>
@ -52,19 +50,16 @@ const TraceItem: React.FC<TraceItemProps> = ({ t, last, txData }) => {
type TraceChildrenProps = { type TraceChildrenProps = {
c: TraceGroup[]; c: TraceGroup[];
txData: TransactionData;
}; };
const TraceChildren: React.FC<TraceChildrenProps> = React.memo( const TraceChildren: React.FC<TraceChildrenProps> = React.memo(({ c }) => {
({ c, txData }) => { return (
return ( <>
<> {c.map((tc, i, a) => (
{c.map((tc, i, a) => ( <TraceItem key={i} t={tc} last={i === a.length - 1} />
<TraceItem key={i} t={tc} last={i === a.length - 1} txData={txData} /> ))}
))} </>
</> );
); });
}
);
export default TraceItem; export default TraceItem;