From 6bce12352853796d220f9482f3ce346734e3d7b1 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Sat, 15 Feb 2025 19:43:12 +0000 Subject: [PATCH] Show more feedback for compiled noir program --- apps/noir-compiler/src/app/app.tsx | 2 +- apps/noir-compiler/src/app/components/container.tsx | 12 +++++++++++- .../src/app/services/noirPluginClient.ts | 2 ++ apps/noir-compiler/src/app/types/index.ts | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/apps/noir-compiler/src/app/app.tsx b/apps/noir-compiler/src/app/app.tsx index 4c5d396f85..cbf21a0e01 100644 --- a/apps/noir-compiler/src/app/app.tsx +++ b/apps/noir-compiler/src/app/app.tsx @@ -40,7 +40,7 @@ function App() { // noir compiling events plugin.internalEvents.on('noir_compiling_start', () => dispatch({ type: 'SET_COMPILER_STATUS', payload: 'compiling' })) plugin.internalEvents.on('noir_compiling_done', () => { - dispatch({ type: 'SET_COMPILER_STATUS', payload: 'idle' }) + dispatch({ type: 'SET_COMPILER_STATUS', payload: 'succeed' }) dispatch({ type: 'SET_COMPILER_FEEDBACK', payload: null }) }) plugin.internalEvents.on('noir_compiling_errored', noirCompilerErrored) diff --git a/apps/noir-compiler/src/app/components/container.tsx b/apps/noir-compiler/src/app/components/container.tsx index 062149bb59..2309f97894 100644 --- a/apps/noir-compiler/src/app/components/container.tsx +++ b/apps/noir-compiler/src/app/components/container.tsx @@ -1,5 +1,5 @@ import { useContext } from 'react' -import { CompileBtn, CompilerFeedback, CompilerReport, CustomTooltip, RenderIf } from '@remix-ui/helper' +import { CompileBtn, CompilerFeedback, CompilerReport, CustomTooltip, extractNameFromKey, extractParentFromKey, RenderIf } from '@remix-ui/helper' import { FormattedMessage } from 'react-intl' import { NoirAppContext } from '../contexts' import { CompileOptions } from '@remix-ui/helper' @@ -37,6 +37,11 @@ export function Container () { compileNoirCircuit(noirApp.plugin, noirApp.appState) } + const handleViewProgramArtefact = (e: React.MouseEvent) => { + e.preventDefault() + noirApp.plugin.call('fileManager', 'open', `${extractParentFromKey(noirApp.appState.filePath)}/build/${extractNameFromKey(noirApp.appState.filePath).replace('.nr', '.json')}`) + } + return (
diff --git a/apps/noir-compiler/src/app/services/noirPluginClient.ts b/apps/noir-compiler/src/app/services/noirPluginClient.ts index 0274134099..8592c929b2 100644 --- a/apps/noir-compiler/src/app/services/noirPluginClient.ts +++ b/apps/noir-compiler/src/app/services/noirPluginClient.ts @@ -65,6 +65,8 @@ export class NoirPluginClient extends PluginClient { this.emit('statusChanged', { key: 'succeed', title: 'Noir circuit compiled successfully', type: 'success' }) // @ts-ignore this.call('terminal', 'log', { type: 'log', value: 'Compiled successfully' }) + // @ts-ignore + await this.call('editor', 'clearErrorMarkers', [path]) } catch (e) { const regex = /^\s*(\/[^:]+):(\d+):/gm; const pathContent = await this.call('fileManager', 'readFile', path) diff --git a/apps/noir-compiler/src/app/types/index.ts b/apps/noir-compiler/src/app/types/index.ts index 42753b3f05..6f6c8f5eb1 100644 --- a/apps/noir-compiler/src/app/types/index.ts +++ b/apps/noir-compiler/src/app/types/index.ts @@ -2,7 +2,7 @@ import { compiler_list } from 'circom_wasm' import { Dispatch } from 'react' import type { NoirPluginClient } from '../services/noirPluginClient' -export type CompilerStatus = "compiling" | "idle" | "errored" | "warning" +export type CompilerStatus = "compiling" | "idle" | "errored" | "warning" | "succeed" export interface INoirAppContext { appState: AppState dispatch: Dispatch,