added permission modal

pull/4845/head
aniket-engg 6 months ago committed by Aniket
parent 4dd99591fe
commit 06e6510b3a
  1. 7
      apps/remix-ide/src/app/tabs/locales/en/udapp.json
  2. 17
      libs/remix-ui/run-tab/src/lib/components/universalDappUI.tsx

@ -80,6 +80,12 @@
"udapp.pinnedAt": "Pinned at",
"udapp.filePath": "File path",
"udapp.solScan.iconTooltip": "Run Solidity scan for contract",
"udapp.solScan.modalTitle": "Permission to share code",
"udapp.solScan.modalMessage": "Contract code will be shared to third party Solidity Scan.\n Would you like to continue?",
"udapp.solScan.modalOkLabel": "Continue",
"udapp.solScan.modalCancelLabel": "Cancel",
"udapp._comment_recorderCardUI.tsx": "libs/remix-ui/run-tab/src/lib/components/recorderCardUI.tsx",
"udapp.transactionsRecorded": "Transactions recorded",
"udapp.transactionsCountTooltip": "The number of recorded transactions",
@ -111,7 +117,6 @@
"udapp.tooltipTextRemove": "Remove from the list",
"udapp.tooltipTextEdit": "Create a DApp using this contract in the main panel",
"udapp.tooltipTextPin": "Pin contract",
"udapp.tooltipTextSolScan": "Run Solidity scan for contract",
"udapp.tooltipText8": "Click for docs about using 'receive'/'fallback'",
"udapp.tooltipText9": "The Calldata to send to fallback function of the contract.",
"udapp.tooltipText10": "Send data to contract.",

@ -6,6 +6,7 @@ import { FuncABI } from '@remix-project/core-plugin'
import { CopyToClipboard } from '@remix-ui/clipboard'
import * as remixLib from '@remix-project/remix-lib'
import * as ethJSUtil from '@ethereumjs/util'
import { AppModal } from '@remix-ui/app'
import { ContractGUI } from './contractGUI'
import { TreeView, TreeViewItem } from '@remix-ui/tree-view'
import { BN } from 'bn.js'
@ -217,6 +218,20 @@ export function UniversalDappUI(props: UdappProps) {
setCalldataValue(value)
}
const askPermissionToScan = async () => {
const modal: AppModal = {
id: 'SolidityScanPermissionHandler',
title: <FormattedMessage id="udapp.solScan.modalTitle" />,
message: <FormattedMessage id="udapp.solScan.modalMessage" />,
okLabel: <FormattedMessage id="udapp.solScan.modalOkLabel" />,
cancelLabel: <FormattedMessage id="udapp.solScan.modalCancelLabel" />
}
const result = await props.plugin.call('notification', 'modal', modal)
console.log('askPermissionToScan----> result----->', result)
}
const label = (key: string | number, value: string) => {
return (
<div className="d-flex mt-2 flex-row label_item">
@ -308,7 +323,7 @@ export function UniversalDappUI(props: UdappProps) {
</CustomTooltip>
)}
<CustomTooltip placement="top" tooltipClasses="text-nowrap" tooltipId="udapp_udappSolScanTooltip" tooltipText={<FormattedMessage id="udapp.tooltipTextSolScan" />}>
<i className="fas fa-qrcode btn btn-sm p-0"></i>
<i className="fas fa-qrcode btn btn-sm p-0" onClick={askPermissionToScan}></i>
</CustomTooltip>
</div>
{ props.isPinnedContract && props.instance.pinnedAt ? (

Loading…
Cancel
Save