diff --git a/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx b/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx index 51a539418d..8f3c2307df 100644 --- a/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx +++ b/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx @@ -4,6 +4,7 @@ import { ErrorRendererOptions } from '../../staticanalyser' type BasicTitleProps = { warningStateEntries: any hideWarnings?: boolean + showLibsWarnings?: boolean } type warningResultOption = { @@ -32,13 +33,15 @@ export function calculateWarningStateEntries(entries: [string, any][]) { export function BasicTitle(props: BasicTitleProps) { return ( - Remix{props.warningStateEntries.length > 0 ? !props.hideWarnings ? 0 ? 'badge-warning' : 'badge-danger'} rounded-circle ml-1 text-center`}>{calculateWarningStateEntries(props.warningStateEntries).length}: ( - - { - calculateWarningStateEntries(props.warningStateEntries).errors.length - } - - ) : null} + Remix{props.warningStateEntries.length > 0 ? !props.hideWarnings ? props.showLibsWarnings ? 0 ? 'badge-warning' : 'badge-danger'} rounded-circle ml-1 text-center`}> + { + calculateWarningStateEntries(props.warningStateEntries).length}: ( + + { + calculateWarningStateEntries(props.warningStateEntries).errors.length + } + + ) : null : null} ) } diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx index 1f35d4a677..361da8684a 100644 --- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx +++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx @@ -81,6 +81,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { const [hints, setHints] = useState([]) const [slitherWarnings, setSlitherWarnings] = useState([]) const [ssaWarnings, setSsaWarnings] = useState([]) + const [tabKey, setTabKey] = useState('basic') const warningContainer = useRef(null) const allWarnings = useRef({}) @@ -107,6 +108,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { } useEffect(() => { + setWarningState({}) setHints([]) setSlitherWarnings([]) setSsaWarnings([]) @@ -143,7 +145,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { useEffect(() => { props.analysisModule.on('filePanel', 'setWorkspace', (currentWorkspace) => { // Reset warning state - setWarningState([]) + setWarningState({}) // Reset badge props.event.trigger('staticAnaysisWarning', []) // Reset state @@ -165,7 +167,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { // Hide 'Enable Slither Analysis' checkbox if (plugin.name === 'remixd') { // Reset warning state - setWarningState([]) + setWarningState({}) setHints([]) setSlitherWarnings([]) setSlitherEnabled(false) @@ -218,8 +220,10 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { } } } - props.event.trigger('staticAnaysisWarning', [newWarningCount]) - setWarningState(newWarningState) + if (newWarningCount > 0) { + props.event.trigger('staticAnaysisWarning', [newWarningCount]) + setWarningState(newWarningState) + } } useEffect(() => { @@ -511,6 +515,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { ), child: ( @@ -520,8 +525,8 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
{Object.entries(warningState).map((element, index) => (
- { !hideWarnings && element[1]['length'] > 0 ? {element[0]} : null} - {!hideWarnings ? element[1]["map"]( + { hideWarnings === false ? {element[0]} : null} + { hideWarnings === false ? element[1]["map"]( (x,i) => // eslint-disable-line dot-notation x.hasWarning ? ( // eslint-disable-next-line dot-notation @@ -753,8 +758,9 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { />
setTabKey(newKey)} > { checkBasicStatus() ? { {tabKeys[1].child} : null } - {solhintEnabled ? - {tabKeys[0].child} - : null} + { + solhintEnabled ? + {tabKeys[0].child} + : null + } { showSlither && slitherEnabled ?