From 8ba75251e6dd5d1dd7e69f310fc31636ba690710 Mon Sep 17 00:00:00 2001 From: Manuel Wedler Date: Mon, 1 Jul 2024 18:06:57 +0200 Subject: [PATCH] Make receipts view prettier --- .../src/app/components/AccordionReceipt.tsx | 97 +++++++++++-------- .../src/app/views/ReceiptsView.tsx | 14 ++- .../src/app/views/example.js | 1 + 3 files changed, 66 insertions(+), 46 deletions(-) diff --git a/apps/contract-verification/src/app/components/AccordionReceipt.tsx b/apps/contract-verification/src/app/components/AccordionReceipt.tsx index c6631d37b3..fd3e5b5c5f 100644 --- a/apps/contract-verification/src/app/components/AccordionReceipt.tsx +++ b/apps/contract-verification/src/app/components/AccordionReceipt.tsx @@ -1,12 +1,14 @@ import React from 'react' import { SubmittedContract } from '../types/VerificationTypes' +import { shortenAddress, CustomTooltip } from '@remix-ui/helper' interface AccordionReceiptProps { contract: SubmittedContract + chainName: string index: number } -export const AccordionReceipt: React.FC = ({ contract, index }) => { +export const AccordionReceipt: React.FC = ({ contract, index, chainName }) => { const [expanded, setExpanded] = React.useState(false) const toggleAccordion = () => { @@ -14,50 +16,59 @@ export const AccordionReceipt: React.FC = ({ contract, in } return ( -
-
-

- +
+

+ +

+
+
- {contract.address} on {contract.chainId} (Add chain name) + Chain ID: + {contract.chainId}
-

-
-
-
Chain ID: {contract.chainId}
-
- filePath: {contract.filePath} contractName: {contract.contractName} -
-
Submission Date: {contract.date.toLocaleString()}
-
- Receipts: -
- - - - - - - - - - - - {contract.receipts.map((receipt) => ( - - - - - - - - ))} - -
VerifierAPI UrlStatusMessageReceiptID
{receipt.verifier.name}{receipt.verifier.apiUrl}{receipt.status}{receipt.message}{receipt.receiptId}
-
-
+
+ File: + {contract.filePath} +
+
+ Contract: + {contract.contractName} +
+
+ Submission: + {contract.date.toLocaleString()} +
+
+ + + + + + + + + + + + {contract.receipts.map((receipt) => ( + + + + + + + + ))} + +
VerifierAPI URLStatusMessageReceiptID
{receipt.verifier.name}{receipt.verifier.apiUrl}{receipt.status}{receipt.message}{receipt.receiptId}
diff --git a/apps/contract-verification/src/app/views/ReceiptsView.tsx b/apps/contract-verification/src/app/views/ReceiptsView.tsx index c46d99acde..f915a02788 100644 --- a/apps/contract-verification/src/app/views/ReceiptsView.tsx +++ b/apps/contract-verification/src/app/views/ReceiptsView.tsx @@ -5,15 +5,23 @@ import { AccordionReceipt } from '../components/AccordionReceipt' import { SubmittedContract } from '../types/VerificationTypes' export const ReceiptsView = () => { + const { chains } = React.useContext(AppContext) // const {submittedContracts} = React.useContext(AppContext); + const getChainName = (chainId: string) => { + return chains.find((chain) => chain.chainId === parseInt(chainId))?.name ?? 'Unknown Chain' + } + const submittedContracts = example as unknown as Record console.log('submittedContracts', submittedContracts) return ( - <> +
+ {Object.values(submittedContracts).map((contract, index) => ( + + ))} {Object.values(submittedContracts).map((contract, index) => ( - + ))} - +
) } diff --git a/apps/contract-verification/src/app/views/example.js b/apps/contract-verification/src/app/views/example.js index d013b96e0c..129bdf051f 100644 --- a/apps/contract-verification/src/app/views/example.js +++ b/apps/contract-verification/src/app/views/example.js @@ -28,6 +28,7 @@ const json = { message: 'Failed to fetch', }, ], + chainId: "1" }, }