fix slither tab visibility and label

pull/3779/head
Joseph Izang 1 year ago
parent 7a16307ad3
commit a718b30438
  1. 2
      libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx
  2. 34
      libs/remix-ui/static-analyser/src/lib/Button/StaticAnalyserButton.tsx
  3. 14
      libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx

@ -58,7 +58,7 @@ export const RemixUiCheckbox = ({
checked={checked} checked={checked}
disabled={disabled} disabled={disabled}
/> />
<label className="form-check-label custom-control-label" id={`heading${categoryId}`} style={{ paddingTop: '0.15rem' }}> <label className="form-check-label custom-control-label" id={`heading${categoryId}`} style={{ paddingTop: '0.15rem' }} aria-disabled={disabled}>
{name ? <div className="font-weight-bold">{itemName}</div> : ''} {name ? <div className="font-weight-bold">{itemName}</div> : ''}
{label} {label}
</label> </label>

@ -19,20 +19,32 @@ const StaticAnalyserButton = ({
const defaultStyle = "btn btn-sm w-25 btn-primary" const defaultStyle = "btn btn-sm w-25 btn-primary"
const newclassList = disabled && classList.length > 0 ? `${classList} disabled` : const newclassList = disabled && classList.length > 0 ? `${classList} disabled` :
classList.length === 0 && disabled ? `${defaultStyle} disabled` : classList.length > 0 ? `${classList}` : defaultStyle classList.length === 0 && disabled ? `${defaultStyle} disabled` : classList.length > 0 ? `${classList}` : defaultStyle
return (
const buttonWithoutTooltip = () => (
<button id="staticAnalysisRunBtn" className={newclassList} disabled={disabled} onClick={onClick}> <button id="staticAnalysisRunBtn" className={newclassList} disabled={disabled} onClick={onClick}>
<CustomTooltip <span className="pl-3 pr-4">
placement="right" {buttonText}
tooltipId="ssaRunButtonTooltip" </span>
tooltipClasses="text-nowrap"
tooltipText={title}
>
<span className="pl-3 pr-4">
{buttonText}
</span>
</CustomTooltip>
</button> </button>
) )
const buttonWithTooltip = () => (
<button id="staticAnalysisRunBtn" className={newclassList} disabled={disabled} onClick={onClick}>
<CustomTooltip
placement="right"
tooltipId="ssaRunButtonTooltip"
tooltipClasses="text-nowrap"
tooltipText={title}
>
<span className="pl-3 pr-4">
{buttonText}
</span>
</CustomTooltip>
</button>)
return (
title && title.length > 0 ? buttonWithTooltip() : buttonWithoutTooltip()
)
} }
export default StaticAnalyserButton export default StaticAnalyserButton

@ -657,17 +657,23 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
label="Slither" label="Slither"
onChange={() => {}} onChange={() => {}}
optionalClassName="mr-3" optionalClassName="mr-3"
title={slitherEnabled ? "Run Slither static analysis." : "To have slither active, you need to have remixd connected to your local filesystem"} title={slitherEnabled ? "Run Slither static analysis." : "To run Slither analysis, Remix IDE must be connected to your local filesystem with Remixd."}
/> />
</div> </div>
<Button {state.data && state.file.length > 0 && state.source ? <Button
buttonText={`Analyse ${state.file}`}
classList="btn btn-sm btn-primary btn-block"
onClick={async () => await run(state.data, state.source, state.file, state , props, isSupportedVersion, showSlither, categoryIndex, groupedModules, runner,_paq,
message, showWarnings, allWarnings, warningContainer, calculateWarningStateEntries, warningState, setHints, hints, setSlitherWarnings, setSsaWarnings)}
disabled={(state.data === null || !isSupportedVersion) || (!solhintEnabled && !basicEnabled) }
/> : <Button
buttonText={`Analyse ${state.file}`} buttonText={`Analyse ${state.file}`}
title={`${runButtonTitle}`} title={`${runButtonTitle}`}
classList="btn btn-sm btn-primary btn-block" classList="btn btn-sm btn-primary btn-block"
onClick={async () => await run(state.data, state.source, state.file, state , props, isSupportedVersion, showSlither, categoryIndex, groupedModules, runner,_paq, onClick={async () => await run(state.data, state.source, state.file, state , props, isSupportedVersion, showSlither, categoryIndex, groupedModules, runner,_paq,
message, showWarnings, allWarnings, warningContainer, calculateWarningStateEntries, warningState, setHints, hints, setSlitherWarnings, setSsaWarnings)} message, showWarnings, allWarnings, warningContainer, calculateWarningStateEntries, warningState, setHints, hints, setSlitherWarnings, setSsaWarnings)}
disabled={(state.data === null || !isSupportedVersion) || (!solhintEnabled && !basicEnabled) } disabled={(state.data === null || !isSupportedVersion) || (!solhintEnabled && !basicEnabled) }
/> />}
{state && state.data !== null && state.source !== null && state.file.length > 0 ? (<div className="d-flex border-top flex-column"> {state && state.data !== null && state.source !== null && state.file.length > 0 ? (<div className="d-flex border-top flex-column">
<div className="mt-4 p-2 d-flex border-top flex-column"> <div className="mt-4 p-2 d-flex border-top flex-column">
<span>Last results for:</span> <span>Last results for:</span>
@ -719,7 +725,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
> >
{tabKeys[0].child} {tabKeys[0].child}
</Tab> : null} </Tab> : null}
{ showSlither ? <Tab { showSlither && slitherEnabled ? <Tab
key={tabKeys[2].tabKey} key={tabKeys[2].tabKey}
title={tabKeys[2].title} title={tabKeys[2].title}
eventKey={tabKeys[2].tabKey} eventKey={tabKeys[2].tabKey}

Loading…
Cancel
Save