basictabcomponent

pull/3838/head
Joseph Izang 1 year ago
parent 8936c4e834
commit 5f9e20486f
  1. 66
      libs/remix-ui/static-analyser/src/lib/components/BasicTabBody.tsx
  2. 2
      libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx

@ -0,0 +1,66 @@
import React from 'react'
import ErrorRenderer from "../ErrorRenderer"
type BasicTabBodyProps = {
state: any
hideWarnings: boolean
showLibsWarning: boolean
warningState: any
startAnalysis: boolean
analysisModule: any
}
export function BasicTabBody({ state, hideWarnings, showLibsWarning, warningState, startAnalysis, analysisModule}: BasicTabBodyProps) {
return (
<>
{Object.entries(warningState).length > 0 ? (
<div id="staticanalysisresult">
<div className="mb-4 pt-2">
{Object.entries(warningState).map((element, index) => (
<div key={index}>
{ hideWarnings === false ? <span className="text-dark h6">{element[0]}</span> : null}
{ hideWarnings === false ? element[1]["map"](
(x,i) => // eslint-disable-line dot-notation
x.hasWarning
? ( // eslint-disable-next-line dot-notation
<div
data-id={`staticAnalysisModule${x.warningModuleName}${i}`}
id={`staticAnalysisModule${x.warningModuleName}${i}`}
key={i}
>
<ErrorRenderer
name={`staticAnalysisModule${x.warningModuleName}${i}`}
message={x.msg}
opt={x.options}
warningErrors={x.warningErrors}
editor={analysisModule}
/>
</div>
) : null
) : element[1]["map"](
(x,i) => // eslint-disable-line dot-notation
showLibsWarning && x.isLibrary
? ( // eslint-disable-next-line dot-notation
<div
data-id={`staticAnalysisModule${x.warningModuleName}${i}`}
id={`staticAnalysisModule${x.warningModuleName}${i}`}
key={i}
>
<ErrorRenderer
name={`staticAnalysisModule${x.warningModuleName}${i}`}
message={x.msg}
opt={x.options}
warningErrors={x.warningErrors}
editor={analysisModule}
/>
</div>
) : null)}
{}
</div>
))}
</div>
</div>
) : state.data && state.file.length > 0 && state.source && startAnalysis && Object.entries(warningState).length > 0 ? <span className="ml-4 spinner-grow-sm d-flex justify-content-center">Loading...</span> : <span className="display-6 text-center">Nothing to report</span>}
</>
)
}

@ -38,7 +38,7 @@ export function BasicTitle(props: BasicTitleProps) {
calculateWarningStateEntries(props.warningStateEntries).length}</i>: (
<i className="badge badge-warning rounded-circle ml-1 text-center">
{
calculateWarningStateEntries(props.warningStateEntries).errors.length
calculateWarningStateEntries(props.warningStateEntries).length
}
</i>
) : null : null}

Loading…
Cancel
Save