Implemented hide warnings

pull/4144/head
ioedeveloper 1 year ago
parent ae21c6fe26
commit e7e0751f33
  1. 2
      apps/circuit-compiler/src/app/components/container.tsx
  2. 4
      apps/circuit-compiler/src/app/components/feedback.tsx
  3. 7
      apps/circuit-compiler/src/app/components/options.tsx
  4. 7
      apps/circuit-compiler/src/app/reducers/state.ts
  5. 5
      apps/circuit-compiler/src/app/types/index.ts

@ -58,7 +58,7 @@ export function Container () {
</WitnessToggler>
</RenderIf>
<RenderIf condition={circuitApp.appState.status !== 'compiling' && circuitApp.appState.status !== 'computing' && circuitApp.appState.status !== 'generating'}>
<CompilerFeedback feedback={circuitApp.appState.feedback} filePathToId={circuitApp.appState.filePathToId} openErrorLocation={handleOpenErrorLocation} />
<CompilerFeedback feedback={circuitApp.appState.feedback} filePathToId={circuitApp.appState.filePathToId} openErrorLocation={handleOpenErrorLocation} hideWarnings={circuitApp.appState.hideWarnings} />
</RenderIf>
</div>
</div>

@ -4,7 +4,7 @@ import { RenderIf } from '@remix-ui/helper'
import {CopyToClipboard} from '@remix-ui/clipboard'
import { FeedbackAlert } from './feedbackAlert'
export function CompilerFeedback ({ feedback, filePathToId, openErrorLocation }: CompilerFeedbackProps) {
export function CompilerFeedback ({ feedback, filePathToId, hideWarnings, openErrorLocation }: CompilerFeedbackProps) {
const [ showException, setShowException ] = useState<boolean>(true)
const handleCloseException = () => {
@ -43,7 +43,7 @@ export function CompilerFeedback ({ feedback, filePathToId, openErrorLocation }:
<FeedbackAlert message={response.message} location={ response.labels[0] ? response.labels[0].message + ` ${filePathToId[response.labels[0].file_id]}:${response.labels[0].range.start}:${response.labels[0].range.end}` : null} />
</div>
</RenderIf>
<RenderIf condition={response.type === 'Warning'}>
<RenderIf condition={(response.type === 'Warning') && !hideWarnings}>
<div className={`circuit_feedback ${response.type.toLowerCase()} alert alert-warning`}>
<FeedbackAlert message={response.message} location={null} />
</div>

@ -7,6 +7,9 @@ export function CompileOptions () {
const handleCircuitAutoCompile = (value: boolean) => {
dispatch({ type: 'SET_AUTO_COMPILE', payload: value })
}
const handleCircuitHideWarnings = (value: boolean) => {
dispatch({ type: 'SET_HIDE_WARNINGS', payload: value })
}
return (
<div className='pb-2'>
@ -26,11 +29,11 @@ export function CompileOptions () {
<div className="mt-1 mb-2 circuit_warnings_box custom-control custom-checkbox">
<input
className="custom-control-input"
// onChange={handleHideWarningsChange}
onChange={(e) => handleCircuitHideWarnings(e.target.checked)}
id="hideCircuitWarnings"
type="checkbox"
title="Hide warnings"
// checked={state.hideWarnings}
checked={appState.hideWarnings}
/>
<label className="form-check-label custom-control-label" htmlFor="hideCircuitWarnings">
<FormattedMessage id="solidity.hideWarnings" />

@ -9,6 +9,7 @@ export const appInitialState: AppState = {
status: "idle",
primeValue: "bn128",
autoCompile: false,
hideWarnings: false,
signalInputs: [],
feedback: null
}
@ -46,6 +47,12 @@ export const appReducer = (state = appInitialState, action: Actions): AppState =
autoCompile: action.payload
}
case 'SET_HIDE_WARNINGS':
return {
...state,
hideWarnings: action.payload
}
case 'SET_SIGNAL_INPUTS':
return {
...state,

@ -15,6 +15,7 @@ export interface ActionPayloadTypes {
SET_COMPILER_STATUS: CompilerStatus,
SET_PRIME_VALUE: PrimeValue,
SET_AUTO_COMPILE: boolean,
SET_HIDE_WARNINGS: boolean,
SET_SIGNAL_INPUTS: string[],
SET_COMPILER_FEEDBACK: string | CompilerReport[]
SET_FILE_PATH_TO_ID: Record<number, string>
@ -34,6 +35,7 @@ export interface AppState {
status: CompilerStatus,
primeValue: PrimeValue,
autoCompile: boolean,
hideWarnings: boolean,
signalInputs: string[],
feedback: string | CompilerReport[]
}
@ -48,7 +50,8 @@ export type PrimeValue = "bn128" | "bls12381" | "goldilocks"
export type CompilerFeedbackProps = {
feedback: string | CompilerReport[],
filePathToId: Record<string, string>,
openErrorLocation: (location: string, startRange: string) => void
openErrorLocation: (location: string, startRange: string) => void,
hideWarnings: boolean
}
export type CompilerReport = {

Loading…
Cancel
Save