Implemented hide warnings

pull/5370/head
ioedeveloper 1 year ago
parent faa8300641
commit 77d79c42f5
  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> </WitnessToggler>
</RenderIf> </RenderIf>
<RenderIf condition={circuitApp.appState.status !== 'compiling' && circuitApp.appState.status !== 'computing' && circuitApp.appState.status !== 'generating'}> <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> </RenderIf>
</div> </div>
</div> </div>

@ -4,7 +4,7 @@ import { RenderIf } from '@remix-ui/helper'
import {CopyToClipboard} from '@remix-ui/clipboard' import {CopyToClipboard} from '@remix-ui/clipboard'
import { FeedbackAlert } from './feedbackAlert' 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 [ showException, setShowException ] = useState<boolean>(true)
const handleCloseException = () => { 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} /> <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> </div>
</RenderIf> </RenderIf>
<RenderIf condition={response.type === 'Warning'}> <RenderIf condition={(response.type === 'Warning') && !hideWarnings}>
<div className={`circuit_feedback ${response.type.toLowerCase()} alert alert-warning`}> <div className={`circuit_feedback ${response.type.toLowerCase()} alert alert-warning`}>
<FeedbackAlert message={response.message} location={null} /> <FeedbackAlert message={response.message} location={null} />
</div> </div>

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

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

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

Loading…
Cancel
Save