From 22685a06900cdae59ed47d1f97f983b59174fc4a Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 22 Jun 2021 16:10:09 +0100 Subject: [PATCH] Set default value for compiler list --- .../src/lib/compiler-container.tsx | 26 ++++++++----------- .../src/lib/solidity-compiler.tsx | 3 +++ 2 files changed, 14 insertions(+), 15 deletions(-) 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 1d508e6608..9ffbda3bc9 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -15,6 +15,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { compileTimeout: null, timeout: 300, allversions: [], + customVersions: [], selectedVersion: null, defaultVersion: 'soljson-v0.8.4+commit.c7e474f2.js', // this default version is defined: in makeMockCompiler (for browser test) selectedLanguage: '', @@ -278,9 +279,8 @@ export const CompilerContainer = (props: CompilerContainerProps) => { if (customUrl !== '') { selectedVersion = customUrl setState(prevState => { - return { ...prevState, selectedVersion } + return { ...prevState, selectedVersion, customVersions: [...state.customVersions, selectedVersion] } }) - // this._view.versionSelector.appendChild(yo``) url = customUrl queryParams.update({ version: selectedVersion }) } else if (selectedVersion === 'builtin') { @@ -319,14 +319,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => { // if (this._view.version) this._view.version.innerText = text // } - const promtCompiler = () => { + const promptCompiler = () => { + // custom url https://solidity-blog.s3.eu-central-1.amazonaws.com/data/08preview/soljson.js modal('Add a custom compiler', promptMessage('URL'), 'OK', addCustomCompiler, 'Cancel', () => {}) - // modalDialogCustom.prompt( - // 'Add a custom compiler', - // 'URL', - // '', - // (url) => this.addCustomCompiler(url) - // ) } const promptMessage = (message) => { @@ -447,11 +442,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
- handleLoadVersion(e.target.value) } className="custom-select" id="versionSelector" disabled={state.allversions.length <= 0}> { state.allversions.length <= 0 && } { state.allversions.length <= 0 && } + { state.customVersions.map((url, i) => )} { state.allversions.map((build, i) => { return _shouldBeAdded(build.longVersion) ? @@ -493,9 +489,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
- {/* */} + - {/* { title="Estimated number of times each opcode of the deployed code will be executed across the life-time of the contract." onChange={onChangeRuns} disabled={!state.optimise} - /> */} + />
- {/* */} +
diff --git a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx index b29078280d..080041e8b1 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx @@ -43,6 +43,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { ...prevState, modal: { ...prevState.modal, + hide: false, message, title, okLabel, @@ -74,7 +75,9 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { message={ state.modal.message } hide={ state.modal.hide } okLabel={ state.modal.okLabel } + okFn={ state.modal.okFn } cancelLabel={ state.modal.cancelLabel } + cancelFn={ state.modal.cancelFn } handleHide={ handleHideModal }> { (typeof state.modal.message !== 'string') && state.modal.message }