Commit 6924eb45 authored by tizah's avatar tizah

refactored warning message

parent 6dfe730e
...@@ -105,6 +105,20 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { ...@@ -105,6 +105,20 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
return () => { } return () => { }
}, [autoRun, categoryIndex]) }, [autoRun, categoryIndex])
const message = (name, warning, more, fileName, locationString) : string => {
return (`
<span className='d-flex flex-column'>
<span className='h6 font-weight-bold'>${name}</span>
${warning}
${more
? (<span><a href={more} target='_blank'>more</a></span>)
: (<span> </span>)
}
<span className="" title={Position in ${fileName}}>Pos: ${locationString}</span>
</span>`
)
}
const run = (lastCompilationResult, lastCompilationSource, currentFile) => { const run = (lastCompilationResult, lastCompilationSource, currentFile) => {
if (autoRun) { if (autoRun) {
setResult({ lastCompilationResult, lastCompilationSource, currentFile }) setResult({ lastCompilationResult, lastCompilationSource, currentFile })
...@@ -150,16 +164,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { ...@@ -150,16 +164,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
fileName = Object.keys(lastCompilationResult.contracts)[file] fileName = Object.keys(lastCompilationResult.contracts)[file]
} }
warningCount++ warningCount++
const msg = ` const msg = message(item.name, item.warning, item.more, fileName, locationString)
<span class='d-flex flex-column'>
<span class='h6 font-weight-bold'>${result.name}</span>
${item.warning}
${item.more
? `<span><a href=${item.more} target='_blank'>more</a></span>`
: '<span> </span>'
}
<span class="" title="Position in ${fileName}">Pos: ${locationString}</span>
</span>`
const options = { const options = {
type: 'warning', type: 'warning',
useSpan: true, useSpan: true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment