simplify rearrangement code

pull/2963/head
Joseph Izang 2 years ago committed by Aniket
parent f5e57b6f9d
commit 544623109b
  1. 12
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  2. 2
      libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts

@ -22,15 +22,6 @@ declare global {
const _paq = window._paq = window._paq || [] //eslint-disable-line
function reorderEvms (evmVersions: string[], newEvms: string[]): string[] {
evmVersions.forEach(evm => {
if (evm === 'london') newEvms[1] = evm
else if (evm === 'berlin') newEvms[2] = evm
else newEvms.push(evm)
})
return newEvms
}
export const CompilerContainer = (props: CompilerContainerProps) => {
const {
api,
@ -76,7 +67,6 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
const [hhCompilation, sethhCompilation] = useState(false)
const [truffleCompilation, setTruffleCompilation] = useState(false)
const [compilerContainer, dispatch] = useReducer(compilerReducer, compilerInitialState)
const [evmVersions] = useState<Array<string>>(reorderEvms(compileTabLogic.evmVersions, []))
const intl = useIntl()
@ -881,7 +871,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
<FormattedMessage id='solidity.evmVersion' defaultMessage='EVM Version' />
</label>
<select value={state.evmVersion} onChange={(e) => handleEvmVersionChange(e.target.value)} disabled={state.useFileConfiguration} className="custom-select" id="evmVersionSelector">
{evmVersions.map((version, index) => (<option key={index} data-id={state.evmVersion === version ? 'selected' : ''} value={version}>{version}</option>))}
{compileTabLogic.evmVersions.map((version, index) => (<option key={index} data-id={state.evmVersion === version ? 'selected' : ''} value={version}>{version}</option>))}
</select>
</div>
<div className="mt-1 mt-3 border-dark pb-3 ml-4 remixui_compilerConfig custom-control custom-checkbox">

@ -24,7 +24,7 @@ export class CompileTabLogic {
constructor (public api: ICompilerApi, public contentImport) {
this.event = new EventEmitter()
this.compiler = new Compiler((url, cb) => api.resolveContentAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message)))
this.evmVersions = ['default', 'berlin', 'london', 'istanbul', 'petersburg', 'constantinople', 'byzantium', 'spuriousDragon', 'tangerineWhistle', 'homestead']
this.evmVersions = ['default', 'london', 'berlin', 'istanbul', 'petersburg', 'constantinople', 'byzantium', 'spuriousDragon', 'tangerineWhistle', 'homestead']
}
init () {

Loading…
Cancel
Save