add optional props to static analyser button and round up cosmetic look of ssa

pull/3642/head
Joseph Izang 2 years ago
parent 04d0ab25de
commit 8595339857
  1. 2
      libs/remix-ui/checkbox/src/lib/remix-ui-checkbox.tsx
  2. 11
      libs/remix-ui/static-analyser/src/lib/Button/StaticAnalyserButton.tsx
  3. 38
      libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx

@ -35,7 +35,7 @@ export const RemixUiCheckbox = ({
title, title,
visibility, visibility,
display = 'flex', display = 'flex',
disabled = true, disabled = false,
tooltipPlacement = 'right' tooltipPlacement = 'right'
}: RemixUiCheckboxProps) => { }: RemixUiCheckboxProps) => {

@ -6,18 +6,21 @@ interface StaticAnalyserButtonProps {
buttonText: string, buttonText: string,
disabled?: boolean, disabled?: boolean,
title?: string title?: string
classList?: string
} }
const StaticAnalyserButton = ({ const StaticAnalyserButton = ({
onClick, onClick,
buttonText, buttonText,
disabled, disabled,
title title,
classList
}: StaticAnalyserButtonProps) => { }: StaticAnalyserButtonProps) => {
let classList = "btn btn-sm w-25 btn-primary" const defaultStyle = "btn btn-sm w-25 btn-primary"
classList += disabled ? " disabled" : "" const newclassList = disabled && classList.length > 0 ? `${classList} disabled` :
classList.length === 0 && disabled ? `${defaultStyle} disabled` : classList.length > 0 ? `${classList}` : defaultStyle
return ( return (
<button className={classList} disabled={disabled} onClick={onClick}> <button className={newclassList} disabled={disabled} onClick={onClick}>
<CustomTooltip <CustomTooltip
placement="right" placement="right"
tooltipId="ssaRunButtonTooltip" tooltipId="ssaRunButtonTooltip"

@ -477,12 +477,11 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
return ( return (
<div className="analysis_3ECCBV px-3 pb-1"> <div className="analysis_3ECCBV px-3 pb-1">
<div className="my-2 d-flex flex-column align-items-left"> <div className="my-2 d-flex flex-column align-items-left">
testing... <div className="d-flex justify-content-between mb-3" id="staticanalysisButton">
<div className="d-flex justify-content-between" id="staticanalysisButton">
<RemixUiCheckbox <RemixUiCheckbox
id="autorunstaticanalysis" id="autorunstaticanalysis"
inputType="checkbox" inputType="checkbox"
title="Run static analysis after the compilation" title="Run solhint static analysis on file save"
onClick={handleAutoRun} onClick={handleAutoRun}
checked={autoRun} checked={autoRun}
label="Linter" label="Linter"
@ -498,29 +497,42 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
return x._index.toString() return x._index.toString()
})) }))
}).flat().every(el => categoryIndex.includes(el))} }).flat().every(el => categoryIndex.includes(el))}
label="Select all" label="Basic"
onClick={() => handleCheckAllModules(groupedModules)} onClick={() => handleCheckAllModules(groupedModules)}
onChange={() => {}} onChange={() => {}}
tooltipPlacement={'top-start'} tooltipPlacement={'top-start'}
/> />
<div className="d-flex mt-1" id="enableSlitherAnalysis">
<RemixUiCheckbox <RemixUiCheckbox
id="autorunstaticanalysis" id="enableSlither"
inputType="checkbox" inputType="checkbox"
title="Run static analysis after the compilation" onClick={handleSlitherEnabled}
onClick={handleAutoRun} checked={slitherEnabled}
checked={autoRun} label="Slither"
label="Autorun" disabled={showSlither}
onChange={() => {}} onChange={() => {}}
tooltipPlacement={'bottom-start'}
/> />
<a className="mt-1 text-nowrap" href='https://remix-ide.readthedocs.io/en/latest/slither.html#enable-slither-analysis' target={'_blank'}>
<CustomTooltip
placement={'right'}
tooltipClasses="text-nowrap"
tooltipId="overlay-tooltip"
tooltipText={<span className="border bg-light text-dark p-1 pr-3" style={{minWidth: '230px' }}>Learn how to use Slither Analysis</span>}
>
<i style={{ fontSize: 'medium' }} className={'fal fa-info-circle ml-3'} aria-hidden="true"></i>
</CustomTooltip>
</a>
</div>
</div> </div>
<Button <Button
buttonText="Run" buttonText="Run"
title={runButtonTitle} title={runButtonTitle}
classList="btn btn-sm btn-primary btn-block"
onClick={async () => await run(state.data, state.source, state.file)} onClick={async () => await run(state.data, state.source, state.file)}
disabled={(state.data === null || categoryIndex.length === 0) && !slitherEnabled || !isSupportedVersion } disabled={(state.data === null || categoryIndex.length === 0) && !slitherEnabled || !isSupportedVersion }
/> />
{ showSlither && {/* { showSlither &&
<div className="d-flex mt-2" id="enableSlitherAnalysis"> <div className="d-flex mt-2" id="enableSlitherAnalysis">
<RemixUiCheckbox <RemixUiCheckbox
id="enableSlither" id="enableSlither"
@ -528,7 +540,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
onClick={handleSlitherEnabled} onClick={handleSlitherEnabled}
checked={slitherEnabled} checked={slitherEnabled}
label="Enable Slither Analysis" label="Enable Slither Analysis"
disabled={showSlither}
onChange={() => {}} onChange={() => {}}
/> />
@ -543,7 +555,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
</CustomTooltip> </CustomTooltip>
</a> </a>
</div> </div>
} } */}
</div> </div>
{/* <div id="staticanalysismodules" className="list-group list-group-flush"> {/* <div id="staticanalysismodules" className="list-group list-group-flush">
{Object.keys(groupedModules).map((categoryId, i) => { {Object.keys(groupedModules).map((categoryId, i) => {

Loading…
Cancel
Save