|
|
@ -48,6 +48,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { |
|
|
|
timeout: 300, |
|
|
|
timeout: 300, |
|
|
|
allversions: [], |
|
|
|
allversions: [], |
|
|
|
customVersions: [], |
|
|
|
customVersions: [], |
|
|
|
|
|
|
|
compilerLicense: null, |
|
|
|
selectedVersion: null, |
|
|
|
selectedVersion: null, |
|
|
|
defaultVersion: 'soljson-v0.8.7+commit.e28d00a7.js', // this default version is defined: in makeMockCompiler (for browser test)
|
|
|
|
defaultVersion: 'soljson-v0.8.7+commit.e28d00a7.js', // this default version is defined: in makeMockCompiler (for browser test)
|
|
|
|
runs: '', |
|
|
|
runs: '', |
|
|
@ -185,7 +186,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { |
|
|
|
loadingCompiler() |
|
|
|
loadingCompiler() |
|
|
|
break |
|
|
|
break |
|
|
|
case 'compilerLoaded': |
|
|
|
case 'compilerLoaded': |
|
|
|
compilerLoaded() |
|
|
|
compilerLoaded(compilerContainer.compiler.args[1]) |
|
|
|
break |
|
|
|
break |
|
|
|
case 'compilationFinished': |
|
|
|
case 'compilationFinished': |
|
|
|
compilationFinished() |
|
|
|
compilationFinished() |
|
|
@ -432,14 +433,20 @@ export const CompilerContainer = (props: CompilerContainerProps) => { |
|
|
|
if (!compileIcon.current) return |
|
|
|
if (!compileIcon.current) return |
|
|
|
compileIcon.current.setAttribute('title', 'compiler is loading, please wait a few moments.') |
|
|
|
compileIcon.current.setAttribute('title', 'compiler is loading, please wait a few moments.') |
|
|
|
compileIcon.current.classList.add('remixui_spinningIcon') |
|
|
|
compileIcon.current.classList.add('remixui_spinningIcon') |
|
|
|
|
|
|
|
setState(prevState => { |
|
|
|
|
|
|
|
return { ...prevState, compilerLicense: 'Compiler is loading. License will be displayed once compiler is loaded'} |
|
|
|
|
|
|
|
}) |
|
|
|
_updateLanguageSelector() |
|
|
|
_updateLanguageSelector() |
|
|
|
setDisableCompileButton(true) |
|
|
|
setDisableCompileButton(true) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const compilerLoaded = () => { |
|
|
|
const compilerLoaded = (license) => { |
|
|
|
if (!compileIcon.current) return |
|
|
|
if (!compileIcon.current) return |
|
|
|
compileIcon.current.setAttribute('title', '') |
|
|
|
compileIcon.current.setAttribute('title', '') |
|
|
|
compileIcon.current.classList.remove('remixui_spinningIcon') |
|
|
|
compileIcon.current.classList.remove('remixui_spinningIcon') |
|
|
|
|
|
|
|
setState(prevState => { |
|
|
|
|
|
|
|
return { ...prevState, compilerLicense: license ? license : 'Could not retreive license for selected compiler version' } |
|
|
|
|
|
|
|
}) |
|
|
|
if (state.autoCompile) compile() |
|
|
|
if (state.autoCompile) compile() |
|
|
|
const isDisabled = !compiledFileName || (compiledFileName && !isSolFileSelected(compiledFileName)) |
|
|
|
const isDisabled = !compiledFileName || (compiledFileName && !isSolFileSelected(compiledFileName)) |
|
|
|
|
|
|
|
|
|
|
@ -554,6 +561,10 @@ export const CompilerContainer = (props: CompilerContainerProps) => { |
|
|
|
modal('Add a custom compiler', promptMessage('URL'), 'OK', addCustomCompiler, 'Cancel', () => {}) |
|
|
|
modal('Add a custom compiler', promptMessage('URL'), 'OK', addCustomCompiler, 'Cancel', () => {}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const showCompilerLicense = () => { |
|
|
|
|
|
|
|
modal('Compiler License', state.compilerLicense ? state.compilerLicense : 'License not available', 'OK', () => {}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const promptMessage = (message) => { |
|
|
|
const promptMessage = (message) => { |
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
@ -701,10 +712,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => { |
|
|
|
<article> |
|
|
|
<article> |
|
|
|
<div className='pt-0 remixui_compilerSection'> |
|
|
|
<div className='pt-0 remixui_compilerSection'> |
|
|
|
<div className="mb-1"> |
|
|
|
<div className="mb-1"> |
|
|
|
<label className="remixui_compilerLabel form-check-label" htmlFor="versionSelector"> |
|
|
|
<label className="remixui_compilerLabel form-check-label" htmlFor="versionSelector">Compiler</label> |
|
|
|
Compiler |
|
|
|
<span className="far fa-plus border-0 p-0 ml-3" onClick={() => promptCompiler()} title="Add a custom compiler with URL"></span> |
|
|
|
<button className="far fa-plus btn-light border-0 p-0 mx-2 btn-sm" onClick={promptCompiler} title="Add a custom compiler with URL"></button> |
|
|
|
<span className="fa fa-file-text-o border-0 p-0 ml-2" onClick={() => showCompilerLicense()} title="See compiler license"></span> |
|
|
|
</label> |
|
|
|
|
|
|
|
<select value={ state.selectedVersion || state.defaultVersion } onChange={(e) => handleLoadVersion(e.target.value) } className="custom-select" id="versionSelector" disabled={state.allversions.length <= 0}> |
|
|
|
<select value={ state.selectedVersion || state.defaultVersion } onChange={(e) => handleLoadVersion(e.target.value) } className="custom-select" id="versionSelector" disabled={state.allversions.length <= 0}> |
|
|
|
{ state.allversions.length <= 0 && <option disabled data-id={state.selectedVersion === state.defaultVersion ? 'selected' : ''}>{ state.defaultVersion }</option> } |
|
|
|
{ state.allversions.length <= 0 && <option disabled data-id={state.selectedVersion === state.defaultVersion ? 'selected' : ''}>{ state.defaultVersion }</option> } |
|
|
|
{ state.allversions.length <= 0 && <option disabled data-id={state.selectedVersion === 'builtin' ? 'selected' : ''}>builtin</option> } |
|
|
|
{ state.allversions.length <= 0 && <option disabled data-id={state.selectedVersion === 'builtin' ? 'selected' : ''}>builtin</option> } |
|
|
|