diff --git a/apps/remix-ide-e2e/src/commands/verifyContracts.ts b/apps/remix-ide-e2e/src/commands/verifyContracts.ts index 027f71dd05..e7dbf4a591 100644 --- a/apps/remix-ide-e2e/src/commands/verifyContracts.ts +++ b/apps/remix-ide-e2e/src/commands/verifyContracts.ts @@ -22,6 +22,9 @@ function verifyContracts (browser: NightwatchBrowser, compiledContractNames: str if (opts.version) { browser .click('*[data-id="compilation-details"]') + .waitForElementVisible('*[data-id="remixui_treeviewitem_metadata"]') + .pause(2000) + .click('*[data-id="remixui_treeviewitem_metadata"]') .waitForElementVisible('*[data-id="treeViewDivtreeViewItemcompiler"]') .pause(2000) .click('*[data-id="treeViewDivtreeViewItemcompiler"]') diff --git a/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx b/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx index ec016068e9..6a764a85e2 100644 --- a/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx +++ b/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx @@ -16,6 +16,24 @@ export const ModalDialog = (props: ModalDialogProps) => { modal.current.focus() }, [props.hide]) + useEffect(() => { + function handleBlur (e) { + if (!e.currentTarget.contains(e.relatedTarget)) { + e.stopPropagation() + if (document.activeElement !== this) { + handleHide() + } + } + } + if (modal.current) { + modal.current.addEventListener('blur', handleBlur) + + return () => { + modal.current.removeEventListener('blur', handleBlur) + } + } + }, [modal.current]) + const modalKeyEvent = (keyCode) => { if (keyCode === 27) { // Esc if (props.cancelFn) props.cancelFn() @@ -40,13 +58,6 @@ export const ModalDialog = (props: ModalDialogProps) => { handleHide() } - const handleBlur = (e) => { - if (!e.currentTarget.contains(e.relatedTarget)) { - e.stopPropagation() - handleHide() - } - } - return (
{ >
(dispatch: React.Disp }) compileTabLogic.compiler.event.register('loadingCompiler', () => { - dispatch(setCompilerMode('compilationDuration')) + dispatch(setCompilerMode('loadingCompiler')) }) compileTabLogic.compiler.event.register('compilerLoaded', () => { diff --git a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx index 658c533ac6..453bdc30ce 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -35,8 +35,8 @@ export const CompilerContainer = (props: CompilerContainerProps) => { language: '', evmVersion: '' }) + const [disableCompileButton, setDisableCompileButton] = useState(false) const compileIcon = useRef(null) - const warningIcon = useRef(null) const promptMessageInput = useRef(null) const [hhCompilation, sethhCompilation] = useState(false) const [compilerContainer, dispatch] = useReducer(compilerReducer, compilerInitialState) @@ -83,6 +83,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => { }, [compileTabLogic]) useEffect(() => { + const isDisabled = !compiledFileName || (compiledFileName && !isSolFileSelected(compiledFileName)) + + setDisableCompileButton(isDisabled) setState(prevState => { return { ...prevState, compiledFileName } }) @@ -243,14 +246,8 @@ export const CompilerContainer = (props: CompilerContainerProps) => { } const compilationDuration = (speed: number) => { - if (!warningIcon.current) return if (speed > 1000) { - const msg = `Last compilation took ${speed}ms. We suggest to turn off autocompilation.` - - warningIcon.current.setAttribute('title', msg) - warningIcon.current.style.visibility = 'visible' - } else { - warningIcon.current.style.visibility = 'hidden' + console.log(`Last compilation took ${speed}ms. We suggest to turn off autocompilation.`) } } @@ -264,8 +261,8 @@ export const CompilerContainer = (props: CompilerContainerProps) => { if (!compileIcon.current) return compileIcon.current.setAttribute('title', 'compiler is loading, please wait a few moments.') compileIcon.current.classList.add('remixui_spinningIcon') - warningIcon.current.style.visibility = 'hidden' _updateLanguageSelector() + setDisableCompileButton(true) } const compilerLoaded = () => { @@ -273,6 +270,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => { compileIcon.current.setAttribute('title', '') compileIcon.current.classList.remove('remixui_spinningIcon') if (state.autoCompile) compile() + const isDisabled = !compiledFileName || (compiledFileName && !isSolFileSelected(compiledFileName)) + + setDisableCompileButton(isDisabled) } const compilationFinished = () => { @@ -531,6 +531,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {