do not hide modal on download click

pull/3543/head
Aniket-Engg 2 years ago committed by Aniket
parent 4dea9f7b5b
commit ac2da9c971
  1. 3
      libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx
  2. 1
      libs/remix-ui/modal-dialog/src/lib/types/index.ts
  3. 2
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  4. 2
      libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx
  5. 7
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
  6. 4
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts

@ -103,7 +103,8 @@ export const ModalDialog = (props: ModalDialogProps) => {
onClick={() => {
if (props.validation && !props.validation.valid) return
if (props.okFn) props.okFn()
handleHide()
if (props.donotHideOnOkClick) calledHideFunctionOnce.current = false
else handleHide()
}}
>
{props.okLabel ? props.okLabel : 'OK'}

@ -13,6 +13,7 @@ export interface ModalDialogProps {
message?: string | JSX.Element,
okLabel?: string | JSX.Element,
okFn?: (value?:any) => void,
donotHideOnOkClick?: boolean,
cancelLabel?: string | JSX.Element,
cancelFn?: () => void,
modalClass?: string,

@ -281,6 +281,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
'New configuration file', `The file "${configFilePathInput.current.value}" you entered does not exist. Do you want to create a new one?`,
'Create',
async () => await createNewConfigFile(),
false,
'Cancel',
() => {
setShowFilePathInput(false)
@ -580,6 +581,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
promptMessage('URL'),
'OK',
addCustomCompiler,
false,
'Cancel',
() => {}
)

@ -190,7 +190,7 @@ export const ContractSelection = (props: ContractSelectionProps) => {
_paq.push(['trackEvent', 'compiler', 'compilerDetails', 'download'])
saveAs(new Blob([JSON.stringify(contractProperties, null, '\t')]), `${selectedContract}_compData.json`)
}
modal(selectedContract, log, 'Download', downloadFn, 'Close', null)
modal(selectedContract, log, 'Download', downloadFn, true, 'Close', null)
}
const copyBytecode = () => {

@ -27,6 +27,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
message: null,
okLabel: '',
okFn: () => { },
donotHideOnOkClick: false,
cancelLabel: '',
cancelFn: () => { },
handleHide: null
@ -131,7 +132,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
api.setCompilerParameters({ version: value })
}
const modal = async (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => {
const modal = async (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, donotHideOnOkClick: boolean, cancelLabel?: string, cancelFn?: () => void) => {
await setState(prevState => {
return {
...prevState,
@ -142,6 +143,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
title,
okLabel,
okFn,
donotHideOnOkClick,
cancelLabel,
cancelFn
}
@ -190,7 +192,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
<>
<span data-id={`compilationFinishedWith_${currentVersion}`}></span>
{compileErrors[currentFile].error && <Renderer message={compileErrors[currentFile].error.formattedMessage || compileErrors[currentFile].error} plugin={api} opt={{ type: compileErrors[currentFile].error.severity || 'error', errorType: compileErrors[currentFile].error.type }} />}
{compileErrors[currentFile].error && (compileErrors[currentFile].error.mode === 'panic') && modal('Error', panicMessage(compileErrors[currentFile].error.formattedMessage), 'Close', null)}
{compileErrors[currentFile].error && (compileErrors[currentFile].error.mode === 'panic') && modal('Error', panicMessage(compileErrors[currentFile].error.formattedMessage), 'Close', null, false)}
{compileErrors[currentFile].errors && compileErrors[currentFile].errors.length && compileErrors[currentFile].errors.map((err, index) => {
if (hideWarnings) {
if (err.severity !== 'warning') {
@ -212,6 +214,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
hide={state.modal.hide}
okLabel={state.modal.okLabel}
okFn={state.modal.okFn}
donotHideOnOkClick={state.modal.donotHideOnOkClick}
cancelLabel={state.modal.cancelLabel}
cancelFn={state.modal.cancelFn}
handleHide={handleHideModal}>

@ -14,7 +14,7 @@ export interface CompilerContainerProps {
isFoundryProject: boolean,
workspaceName: string,
tooltip: (message: string | JSX.Element) => void,
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void,
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, donotHideOnOkClick?: boolean, cancelLabel?: string, cancelFn?: () => void) => void,
compiledFileName: string,
updateCurrentVersion: any,
configurationSettings: ConfigurationSettings,
@ -26,7 +26,7 @@ export interface ContractSelectionProps {
compiledFileName: string,
contractList: { file: string, name: string }[],
compilerInput: Record<string, any>
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void,
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, donotHideOnOkClick?: boolean, cancelLabel?: string, cancelFn?: () => void) => void,
contractsDetails: Record<string, any>
}

Loading…
Cancel
Save