From 264a202f8da2cec79ebbacee76ac844b95b2da09 Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Wed, 28 Jun 2023 20:19:19 +0100 Subject: [PATCH] fixed tab situation --- .../src/lib/remix-ui-static-analyser.tsx | 93 ++++++++++++------- 1 file changed, 57 insertions(+), 36 deletions(-) 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 54e6940e0b..c949814529 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 @@ -16,6 +16,7 @@ import Tabs from 'react-bootstrap/Tabs' import { AnalysisTab, SolHintReport } from '../staticanalyser' import { run } from './actions/staticAnalysisActions' import { BasicTitle, calculateWarningStateEntries } from './components/BasicTitle' +import { Nav, TabContainer } from 'react-bootstrap' declare global { interface Window { @@ -31,6 +32,8 @@ export interface RemixUiStaticAnalyserProps { analysisModule: AnalysisTab } +type tabSelectionType = 'remix' | 'solhint' | 'slither' | 'none' + export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { const [runner] = useState(new CodeAnalysis()) @@ -81,6 +84,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { const [hints, setHints] = useState([]) const [slitherWarnings, setSlitherWarnings] = useState([]) const [ssaWarnings, setSsaWarnings] = useState([]) + const [selectedTab, setSelectedTab] = useState('remix') const warningContainer = useRef(null) @@ -397,7 +401,11 @@ useEffect(() => { const handleBasicEnabled = () => { if (basicEnabled) { + console.log('remix is: ', { basicEnabled }) setBasicEnabled(false) + if (solhintEnabled) { + setSelectedTab('solhint') + } props.event.trigger('staticAnalysisWarning', [-1]) } else { setBasicEnabled(true) @@ -430,7 +438,8 @@ useEffect(() => { const tabKeys = [ { - tabKey: "linter", + tabKey: "solhint", + connectedState: solhintEnabled, child: ( <> {hints.length > 0 ? ( @@ -545,7 +554,8 @@ useEffect(() => { ), }, { - tabKey: "basic", + tabKey: "remix", + connectedState: basicEnabled, title: ( { }, { tabKey: "slither", + connectedState: slitherEnabled, title: ( Slither @@ -687,7 +698,13 @@ useEffect(() => { })) }).flat().every(el => categoryIndex.includes(el)) } - + useEffect(() => { + const getLastCompiled = async () => { + const lastComp = await props.analysisModule.call('compilerArtefacts', 'getLastCompilationResult') + console.log({ lastComp }) + } + getLastCompiled() + }, [props, state]) return (
@@ -740,8 +757,10 @@ useEffect(() => { {state.data && state.file.length > 0 && state.source ?