Basic title changes subject to hidewarnings

pull/3642/head
Joseph Izang 1 year ago
parent 6a7afd271e
commit 92bb0596fe
  1. 25
      libs/remix-ui/static-analyser/src/lib/components/BasicTitle.tsx

@ -1,20 +1,39 @@
import React from 'react'
import { ErrorRendererOptions } from '../../staticanalyser'
type BasicTitleProps = {
warningStateEntries: any
hideWarnings?: boolean
}
export function calculateWarningStateEntries(entries: any[][]) {
type warningResultOption = {
hasWarning: boolean
msg: string
options: ErrorRendererOptions
}
type WarningResultType = {
categoryName: string
opts: warningResultOption[]
}
export function calculateWarningStateEntries(entries: [string, any][]) {
console.log({entries})
let warninglength = 0
entries.forEach((entry) => {
warninglength += entry[1].length
})
return warninglength
let errors = []
entries.forEach((entry) => {
errors = entry[1].filter(x => x.options.type === 'error')
})
console.log({errors})
return { length: warninglength, errors }
}
export function BasicTitle(props: BasicTitleProps) {
return (
<span className="rounded-circle">Basic{props.warningStateEntries.length > 0 ? <i className="badge badge-info rounded-circle ml-2">{calculateWarningStateEntries(props.warningStateEntries)}</i>: null}
<span className="rounded-circle">Basic{props.warningStateEntries.length > 0 && !props.hideWarnings ? <i className="badge badge-info rounded-circle ml-2">{calculateWarningStateEntries(props.warningStateEntries).length}</i>: null}
</span>
)
}
Loading…
Cancel
Save