From 146ed8277ec62eadb36ca4fe6f08107ab6ca56bc Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Thu, 22 Jun 2023 00:42:19 +0100 Subject: [PATCH] take advantage of flattening warning object --- .../src/lib/components/BasicTitle.tsx | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) 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 59b4a12402..384701a219 100644 --- a/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx +++ b/libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx @@ -5,6 +5,8 @@ type BasicTitleProps = { warningStateEntries: any hideWarnings?: boolean showLibsWarnings?: boolean + ssaWarnings: any[] + ssaWarningsNoLibs: any[] } type warningResultOption = { @@ -31,31 +33,24 @@ export function calculateWarningStateEntries(entries: [string, any][]) { } export function BasicTitle(props: BasicTitleProps) { - const[warningCount, setWarningCount] = React.useState(props.warningStateEntries.length) - useEffect(() => { - - }, [props.warningStateEntries.length]) return ( Remix - {props.warningStateEntries.length > 0 ? ( - !props.hideWarnings ? ( - !props.showLibsWarnings ? ( + {props.ssaWarnings.length > 0 ? ( + props.hideWarnings === false ? ( + props.showLibsWarnings === false ? ( - 0 - ? "badge-warning" + className={`badge ${props.ssaWarningsNoLibs.length > 0 ? "badge-warning" : "badge-danger" } badge-pill ml-1 px-1 text-center`} > - {calculateWarningStateEntries(props.warningStateEntries).length} + {props.ssaWarnings.filter(x => x.options.isLibrary === false).length} ) : ( - {warningCount} + {props.ssaWarnings.length} ) ) : null