modal details updated

pull/4735/head
aniket-engg 6 months ago committed by Aniket
parent 33bfc8f5ef
commit ff0af721e3
  1. 4
      apps/remix-ide/src/app/tabs/locales/en/udapp.json
  2. 9
      libs/remix-ui/run-tab/src/lib/components/solScanTable.tsx
  3. 23
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx

@ -85,8 +85,8 @@
"udapp.solScan.modalMessage": "To scan the contract for vulnerabilities & possible risks, smart contract code will be shared to third-party SolidityScan (https://solidityscan.com/).\n\n Would you like to continue?", "udapp.solScan.modalMessage": "To scan the contract for vulnerabilities & possible risks, smart contract code will be shared to third-party SolidityScan (https://solidityscan.com/).\n\n Would you like to continue?",
"udapp.solScan.modalOkLabel": "Continue", "udapp.solScan.modalOkLabel": "Continue",
"udapp.solScan.modalCancelLabel": "Cancel", "udapp.solScan.modalCancelLabel": "Cancel",
"udapp.solScan.errModalTitle": "Scanning error", "udapp.solScan.errModalTitle": "Scan error",
"udapp.solScan.successModalTitle": "Scanning successful", "udapp.solScan.successModalTitle": "Scan result",
"udapp._comment_recorderCardUI.tsx": "libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx", "udapp._comment_recorderCardUI.tsx": "libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx",

@ -3,13 +3,17 @@ import React from 'react'
import parse from 'html-react-parser'; import parse from 'html-react-parser';
interface SolScanTableProps { interface SolScanTableProps {
scanDetails: Record<string, any>[] scanDetails: Record<string, any>[],
fileName: string
} }
export function SolScanTable(props: SolScanTableProps) { export function SolScanTable(props: SolScanTableProps) {
const { scanDetails } = props const { scanDetails, fileName } = props
return ( return (
<>
<p>Scanning successful! <b>{scanDetails.length} warnings </b> found for file: <b>{fileName}</b></p>
<p>See the warning details below. For more details, <a href="https://solidityscan.com/signup">Sign up with SolidityScan</a></p>
<table className="table table-bordered table-hover"> <table className="table table-bordered table-hover">
<thead> <thead>
<tr> <tr>
@ -35,5 +39,6 @@ export function SolScanTable(props: SolScanTableProps) {
</tbody> </tbody>
</table> </table>
</>
) )
} }

@ -275,12 +275,23 @@ export function UniversalDappUI(props: UdappProps) {
const { data: scanData } = await axios.post('https://solidityscan.remixproject.org/downloadResult', { url }) const { data: scanData } = await axios.post('https://solidityscan.remixproject.org/downloadResult', { url })
const scanDetails: Record<string, any>[] = scanData.scan_report.multi_file_scan_details const scanDetails: Record<string, any>[] = scanData.scan_report.multi_file_scan_details
const modal: AppModal = { let modal: AppModal
id: 'SolidityScanSuccess',
title: <FormattedMessage id="udapp.solScan.successModalTitle" />, if (scanDetails && scanDetails.length) {
message: <SolScanTable scanDetails={scanDetails} />, modal = {
okLabel: 'Close', id: 'SolidityScanSuccess',
modalParentClass: 'modal-lg' title: <FormattedMessage id="udapp.solScan.successModalTitle" />,
message: <SolScanTable scanDetails={scanDetails} fileName={fileName}/>,
okLabel: 'Close',
modalParentClass: 'modal-lg'
}
} else {
modal = {
id: 'SolidityScanError',
title: <FormattedMessage id="udapp.solScan.errModalTitle" />,
message: "Some error occurred! Please try again",
okLabel: 'Close'
}
} }
await props.plugin.call('notification', 'modal', modal) await props.plugin.call('notification', 'modal', modal)
} }

Loading…
Cancel
Save