hideWarnings

pull/1860/head
filip mertens 3 years ago committed by yann300
parent 5653c2e290
commit f33630e826
  1. 2
      apps/remix-ide/src/app/plugins/config.ts
  2. 12
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx

@ -21,12 +21,10 @@ export class ConfigPlugin extends Plugin {
const param = params[name] ? params[name] : config.get(name) const param = params[name] ? params[name] : config.get(name)
if (param === 'true') return true if (param === 'true') return true
if (param === 'false') return false if (param === 'false') return false
console.log(param)
return param return param
} }
setAppParameter (name: string, value: any) { setAppParameter (name: string, value: any) {
console.log('setAppParameter', name, value)
const config = Registry.getInstance().get('config').api const config = Registry.getInstance().get('config').api
config.set(name, value) config.set(name, value)
} }

@ -1,4 +1,4 @@
import React, { useState } from 'react' // eslint-disable-line import React, { useEffect, useState } from 'react' // eslint-disable-line
import { SolidityCompilerProps } from './types' import { SolidityCompilerProps } from './types'
import { CompilerContainer } from './compiler-container' // eslint-disable-line import { CompilerContainer } from './compiler-container' // eslint-disable-line
import { ContractSelection } from './contract-selection' // eslint-disable-line import { ContractSelection } from './contract-selection' // eslint-disable-line
@ -31,6 +31,14 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
} }
}) })
const [currentVersion, setCurrentVersion] = useState('') const [currentVersion, setCurrentVersion] = useState('')
const [hideWarnings, setHideWarnings] = useState<boolean>(false)
useEffect(() => {
(async () => {
const hide = await api.getAppParameter('hideWarnings') as boolean || false
setHideWarnings(hide)
})()
}, [])
api.onCurrentFileChanged = (currentFile: string) => { api.onCurrentFileChanged = (currentFile: string) => {
setState(prevState => { setState(prevState => {
@ -118,7 +126,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
{ compileErrors.error && <Renderer message={compileErrors.error.formattedMessage || compileErrors.error} plugin={api} opt={{ type: compileErrors.error.severity || 'error', errorType: compileErrors.error.type }} /> } { compileErrors.error && <Renderer message={compileErrors.error.formattedMessage || compileErrors.error} plugin={api} opt={{ type: compileErrors.error.severity || 'error', errorType: compileErrors.error.type }} /> }
{ compileErrors.error && (compileErrors.error.mode === 'panic') && modal('Error', panicMessage(compileErrors.error.formattedMessage), 'Close', null) } { compileErrors.error && (compileErrors.error.mode === 'panic') && modal('Error', panicMessage(compileErrors.error.formattedMessage), 'Close', null) }
{ compileErrors.errors && compileErrors.errors.length && compileErrors.errors.map((err, index) => { { compileErrors.errors && compileErrors.errors.length && compileErrors.errors.map((err, index) => {
if (api.getAppParameter('hideWarnings')) { if (hideWarnings) {
if (err.severity !== 'warning') { if (err.severity !== 'warning') {
return <Renderer key={index} message={err.formattedMessage} plugin={api} opt={{ type: err.severity, errorType: err.type }} /> return <Renderer key={index} message={err.formattedMessage} plugin={api} opt={{ type: err.severity, errorType: err.type }} />
} }

Loading…
Cancel
Save