diff --git a/frontend/src/components/StreamEntry.js b/frontend/src/components/StreamEntry.js index fe7710a1..a17c7ccb 100644 --- a/frontend/src/components/StreamEntry.js +++ b/frontend/src/components/StreamEntry.js @@ -30,18 +30,17 @@ const StreamEntry = ({ entry, filterCallback, filterConstants }) => { } else if (copyString) { onCopy(); } - - }, [copyString, onCopy, hasCopied, toast]); + }, [copyString, onCopy, hasCopied, toast]); const handleViewClicked = (entryId) => { ui.setEntryId(entryId); ui.setEntriesViewMode("entry"); - useTxCashe.setCurrentTransaction(entry) + useTxCashe.setCurrentTransaction(entry); router.push({ pathname: `/stream/${entry.hash}`, query: router.query, }); }; - + const [showFullView] = useMediaQuery(["(min-width: 420px)"]); console.log(entry); diff --git a/frontend/src/components/TxInfo.js b/frontend/src/components/TxInfo.js index 7038eaf2..16d75c51 100644 --- a/frontend/src/components/TxInfo.js +++ b/frontend/src/components/TxInfo.js @@ -49,49 +49,49 @@ const TxABI = (props) => { ); }; const TxInfo = (props) => { - const transaction = props.transaction; - const dont_display = (key) => { - return !["input"].includes(key) - } - return ( - - - - Value - {transaction.tx.value} - amount of ETH to transfer in WEI - - - Gas - {transaction.tx.gas} - gas limit for transaction - - - Gas price - {transaction.tx.gasPrice} - the fee the sender pays per unit of gas - - - - - - {Object.keys(transaction.tx).filter(dont_display).map((key) => ( - (transaction.tx[key] != undefined && - - - ) - ))} - -
{key}{transaction.tx[key]}
- {transaction.tx.input && transaction.tx.input !== "0x" && - - } -
- - - ) -} + const transaction = props.transaction; + const dont_display = (key) => { + return !["input"].includes(key); + }; + return ( + + + + Value + {transaction.tx.value} + amount of ETH to transfer in WEI + + + Gas + {transaction.tx.gas} + gas limit for transaction + + + Gas price + {transaction.tx.gasPrice} + the fee the sender pays per unit of gas + + + + + + {Object.keys(transaction.tx) + .filter(dont_display) + .map( + (key) => + transaction.tx[key] != undefined && ( + + + + + ) + )} + +
{key}{transaction.tx[key]}
+ {transaction.tx.input && transaction.tx.input !== "0x" && ( + + )} +
+ ); +}; export default TxInfo; diff --git a/frontend/src/core/hooks/index.js b/frontend/src/core/hooks/index.js index a228a75f..9cd995a4 100644 --- a/frontend/src/core/hooks/index.js +++ b/frontend/src/core/hooks/index.js @@ -20,5 +20,5 @@ export { default as useStripe } from "./useStripe"; export { default as useSubscriptions } from "./useSubscriptions"; export { default as useToast } from "./useToast"; export { default as useTxInfo } from "./useTxInfo"; -export { default as useTxCashe } from "./useTxCache" +export { default as useTxCashe } from "./useTxCache"; export { default as useUser } from "./useUser"; diff --git a/frontend/src/core/hooks/useTxCache.js b/frontend/src/core/hooks/useTxCache.js index b015ee78..1994d002 100644 --- a/frontend/src/core/hooks/useTxCache.js +++ b/frontend/src/core/hooks/useTxCache.js @@ -1,7 +1,11 @@ class TxCashe { - currentTransaction = undefined - getCurrentTransaction(){return this.currentTransaction} - setCurrentTransaction(transaction){ this.currentTransaction = transaction} + currentTransaction = undefined; + getCurrentTransaction() { + return this.currentTransaction; + } + setCurrentTransaction(transaction) { + this.currentTransaction = transaction; + } } const useTxCashe = new TxCashe(); -export default useTxCashe; \ No newline at end of file +export default useTxCashe; diff --git a/frontend/src/core/hooks/useTxInfo.js b/frontend/src/core/hooks/useTxInfo.js index 745a92ad..25338cf7 100644 --- a/frontend/src/core/hooks/useTxInfo.js +++ b/frontend/src/core/hooks/useTxInfo.js @@ -4,14 +4,22 @@ import { queryCacheProps } from "./hookCommon"; import { useToast } from "."; const useTxInfo = (transaction) => { - if (!transaction.tx) return {data: "undefined", isLoading: false, isFetchedAfterMount: true, refetch: false, isError: true, error: "undefined"} - const toast = useToast(); - const getTxInfo = async () => { - const response = await TxInfoService.getTxInfo(transaction); - return response.data; - } - const { data, isLoading, isFetchedAfterMount, refetch, isError, error } = - useQuery(["txinfo", transaction.tx.hash ], getTxInfo, { + if (!transaction.tx) + return { + data: "undefined", + isLoading: false, + isFetchedAfterMount: true, + refetch: false, + isError: true, + error: "undefined", + }; + const toast = useToast(); + const getTxInfo = async () => { + const response = await TxInfoService.getTxInfo(transaction); + return response.data; + }; + const { data, isLoading, isFetchedAfterMount, refetch, isError, error } = + useQuery(["txinfo", transaction.tx.hash], getTxInfo, { ...queryCacheProps, onError: (error) => toast(error, "error"), });