Properly differentiate pending/cant decode log data

This commit is contained in:
Willian Mitsuda 2021-09-23 18:46:08 -03:00
parent 380abf2adc
commit 13f32f8a35
2 changed files with 16 additions and 4 deletions

View File

@ -50,7 +50,19 @@ const LogEntry: React.FC<LogEntryProps> = ({ txData, log, logDesc }) => (
</Tab.List> </Tab.List>
<Tab.Panels as={Fragment}> <Tab.Panels as={Fragment}>
<Tab.Panel className="space-y-2"> <Tab.Panel className="space-y-2">
{logDesc && ( {logDesc === undefined ? (
<div className="grid grid-cols-12 gap-x-3 gap-y-5 text-sm">
<div className="col-start-2 flex space-x-2 items-center col-span-11">
Waiting for data...
</div>
</div>
) : logDesc === null ? (
<div className="grid grid-cols-12 gap-x-3 gap-y-5 text-sm">
<div className="col-start-2 flex space-x-2 items-center col-span-11">
No decoded data
</div>
</div>
) : (
<> <>
<div className="grid grid-cols-12 gap-x-3 gap-y-5 text-sm"> <div className="grid grid-cols-12 gap-x-3 gap-y-5 text-sm">
<div className="col-start-2 flex space-x-2 items-center col-span-11 font-mono"> <div className="col-start-2 flex space-x-2 items-center col-span-11 font-mono">

View File

@ -33,7 +33,7 @@ const Logs: React.FC<LogsProps> = ({ txData, metadata }) => {
1, 1,
sourcifySource sourcifySource
); );
const logDesc = useMemo(() => { const logDescs = useMemo(() => {
if (!txData) { if (!txData) {
return undefined; return undefined;
} }
@ -41,7 +41,7 @@ const Logs: React.FC<LogsProps> = ({ txData, metadata }) => {
return txData.confirmedData?.logs.map((l) => { return txData.confirmedData?.logs.map((l) => {
const mt = metadatas[l.address]; const mt = metadatas[l.address];
if (!mt) { if (!mt) {
return undefined; return mt;
} }
const abi = mt.output.abi; const abi = mt.output.abi;
@ -69,7 +69,7 @@ const Logs: React.FC<LogsProps> = ({ txData, metadata }) => {
key={i} key={i}
txData={txData} txData={txData}
log={l} log={l}
logDesc={logDesc?.[i]} logDesc={logDescs?.[i]}
/> />
))} ))}
</> </>