parent
75b011964f
commit
e61ba8f808
@ -1,6 +0,0 @@ |
||||
import { Dispatch } from "react" |
||||
import { Action } from "../types" |
||||
|
||||
export const dispatchCheckRemixd = (status: boolean) => (dispatch: Dispatch<Action<'SET_REMIXD_CONNECTION_STATUS'>>) => { |
||||
dispatch({ type: 'SET_REMIXD_CONNECTION_STATUS', payload: status }) |
||||
} |
@ -1 +0,0 @@ |
||||
import { Dispatch } from 'react' |
@ -1,31 +1,16 @@ |
||||
import React, { useEffect, useReducer, useState } from 'react' |
||||
import { RenderIf, RenderIfNot } from '@remix-ui/helper' |
||||
import { Alert, Button, Tabs, Tab } from 'react-bootstrap' |
||||
import React, { useEffect } from 'react' |
||||
|
||||
import { AppContext } from './contexts' |
||||
import { appInitialState, appReducer } from './reducers' |
||||
import { CircomPluginClient } from './services/circomPluginClient' |
||||
|
||||
function App() { |
||||
const [appState, dispatch] = useReducer(appReducer, appInitialState) |
||||
const [plugin, setPlugin] = useState<CircomPluginClient>(null) |
||||
|
||||
useEffect(() => { |
||||
const plugin = new CircomPluginClient() |
||||
|
||||
setPlugin(plugin) |
||||
new CircomPluginClient() |
||||
}, []) |
||||
|
||||
const value = { |
||||
appState, |
||||
dispatch |
||||
} |
||||
|
||||
return ( |
||||
<AppContext.Provider value={value}> |
||||
<div className="App"> |
||||
</div> |
||||
</AppContext.Provider> |
||||
) |
||||
} |
||||
|
||||
|
@ -1,30 +0,0 @@ |
||||
// const compile = () => {
|
||||
// const currentFile = api.currentFile
|
||||
|
||||
// if (currentFile.endsWith('.circom')) return compileCircuit()
|
||||
// if (!isSolFileSelected()) return
|
||||
// _setCompilerVersionFromPragma(currentFile)
|
||||
// let externalCompType
|
||||
// if (hhCompilation) externalCompType = 'hardhat'
|
||||
// else if (truffleCompilation) externalCompType = 'truffle'
|
||||
// compileTabLogic.runCompiler(externalCompType)
|
||||
// }
|
||||
|
||||
// const compileAndRun = () => {
|
||||
// const currentFile = api.currentFile
|
||||
|
||||
// if (currentFile.endsWith('.circom')) return compileCircuit()
|
||||
// if (!isSolFileSelected()) return
|
||||
// _setCompilerVersionFromPragma(currentFile)
|
||||
// let externalCompType
|
||||
// if (hhCompilation) externalCompType = 'hardhat'
|
||||
// else if (truffleCompilation) externalCompType = 'truffle'
|
||||
// api.runScriptAfterCompilation(currentFile)
|
||||
// compileTabLogic.runCompiler(externalCompType)
|
||||
// }
|
||||
|
||||
// const compileCircuit = () => {
|
||||
// const currentFile = api.currentFile
|
||||
|
||||
// console.log('Compiling circuit ' + currentFile)
|
||||
// }
|
@ -1,4 +0,0 @@ |
||||
import { createContext } from 'react' |
||||
import { IAppContext } from '../types' |
||||
|
||||
export const AppContext = createContext<IAppContext>({} as IAppContext) |
@ -1,18 +0,0 @@ |
||||
import { Actions, AppState } from "../types" |
||||
|
||||
export const appInitialState: AppState = { |
||||
isRemixdConnected: null |
||||
} |
||||
|
||||
export const appReducer = (state = appInitialState, action: Actions): AppState => { |
||||
switch (action.type) { |
||||
case 'SET_REMIXD_CONNECTION_STATUS': |
||||
return { |
||||
...state, |
||||
isRemixdConnected: action.payload |
||||
} |
||||
|
||||
default: |
||||
throw new Error() |
||||
} |
||||
} |
@ -1,22 +0,0 @@ |
||||
import { Dispatch } from "react" |
||||
|
||||
export interface IAppContext { |
||||
appState: AppState, |
||||
dispatch: Dispatch<any> |
||||
} |
||||
|
||||
export interface ActionPayloadTypes { |
||||
SET_REMIXD_CONNECTION_STATUS: boolean |
||||
} |
||||
|
||||
|
||||
export interface Action <T extends keyof ActionPayloadTypes> { |
||||
type: T |
||||
payload: ActionPayloadTypes[T] |
||||
} |
||||
|
||||
export type Actions = { [A in keyof ActionPayloadTypes]: Action<A> }[keyof ActionPayloadTypes] |
||||
|
||||
export interface AppState { |
||||
isRemixdConnected: boolean |
||||
} |
Before Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in new issue