|
|
|
@ -48,6 +48,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { |
|
|
|
|
timeout: 300, |
|
|
|
|
allversions: [], |
|
|
|
|
customVersions: [], |
|
|
|
|
compilerLicense: null, |
|
|
|
|
selectedVersion: null, |
|
|
|
|
defaultVersion: 'soljson-v0.8.7+commit.e28d00a7.js', // this default version is defined: in makeMockCompiler (for browser test)
|
|
|
|
|
runs: '', |
|
|
|
@ -185,7 +186,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { |
|
|
|
|
loadingCompiler() |
|
|
|
|
break |
|
|
|
|
case 'compilerLoaded': |
|
|
|
|
compilerLoaded() |
|
|
|
|
compilerLoaded(compilerContainer.compiler.args[1]) |
|
|
|
|
break |
|
|
|
|
case 'compilationFinished': |
|
|
|
|
compilationFinished() |
|
|
|
@ -432,14 +433,20 @@ 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') |
|
|
|
|
setState(prevState => { |
|
|
|
|
return { ...prevState, compilerLicense: 'Compiler is loading. License will be displayed once compiler is loaded'} |
|
|
|
|
}) |
|
|
|
|
_updateLanguageSelector() |
|
|
|
|
setDisableCompileButton(true) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const compilerLoaded = () => { |
|
|
|
|
const compilerLoaded = (license) => { |
|
|
|
|
if (!compileIcon.current) return |
|
|
|
|
compileIcon.current.setAttribute('title', '') |
|
|
|
|
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() |
|
|
|
|
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', () => {}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const showCompilerLicense = () => { |
|
|
|
|
modal('Compiler License', state.compilerLicense ? state.compilerLicense : 'License not available', 'OK', () => {}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const promptMessage = (message) => { |
|
|
|
|
return ( |
|
|
|
|
<> |
|
|
|
@ -701,10 +712,9 @@ export const CompilerContainer = (props: CompilerContainerProps) => { |
|
|
|
|
<article> |
|
|
|
|
<div className='pt-0 remixui_compilerSection'> |
|
|
|
|
<div className="mb-1"> |
|
|
|
|
<label className="remixui_compilerLabel form-check-label" htmlFor="versionSelector"> |
|
|
|
|
Compiler |
|
|
|
|
<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> |
|
|
|
|
</label> |
|
|
|
|
<label className="remixui_compilerLabel form-check-label" htmlFor="versionSelector">Compiler</label> |
|
|
|
|
<span className="far fa-plus border-0 p-0 ml-3" onClick={() => promptCompiler()} title="Add a custom compiler with URL"></span> |
|
|
|
|
<span className="fa fa-file-text-o border-0 p-0 ml-2" onClick={() => showCompilerLicense()} title="See compiler license"></span> |
|
|
|
|
<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 === 'builtin' ? 'selected' : ''}>builtin</option> } |
|
|
|
|