testing loading of mainpanel plugin

pull/4153/head
Joseph Izang 1 year ago
parent 2d3ff97309
commit ea645508a4
  1. 5
      apps/remix-ide/src/app.js
  2. 69
      apps/remix-ide/src/app/plugins/compile-details.tsx
  3. 1
      apps/remix-ide/src/remixAppManager.js
  4. 1
      libs/remix-ui/solidity-compile-details/src/index.ts
  5. 14
      libs/remix-ui/solidity-compile-details/src/lib/solidity-compile-details.tsx
  6. 14
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  7. 3
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
  8. 1
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts
  9. 7
      tsconfig.paths.json

@ -46,6 +46,7 @@ import {InjectedSKALEChaosTestnetProvider} from './app/providers/injected-skale-
import {FileDecorator} from './app/plugins/file-decorator' import {FileDecorator} from './app/plugins/file-decorator'
import {CodeFormat} from './app/plugins/code-format' import {CodeFormat} from './app/plugins/code-format'
import {SolidityUmlGen} from './app/plugins/solidity-umlgen' import {SolidityUmlGen} from './app/plugins/solidity-umlgen'
import { CompilationDetailsPlugin } from './app/plugins/compile-details'
import {ContractFlattener} from './app/plugins/contractFlattener' import {ContractFlattener} from './app/plugins/contractFlattener'
import {OpenAIGpt} from './app/plugins/openaigpt' import {OpenAIGpt} from './app/plugins/openaigpt'
@ -179,6 +180,9 @@ class AppComponent {
//---------------- Solidity UML Generator ------------------------- //---------------- Solidity UML Generator -------------------------
const solidityumlgen = new SolidityUmlGen(appManager) const solidityumlgen = new SolidityUmlGen(appManager)
// ----------------- Compilation Details ----------------------------
const compilationDetails = new CompilationDetailsPlugin(appManager)
// ----------------- ContractFlattener ---------------------------- // ----------------- ContractFlattener ----------------------------
const contractFlattener = new ContractFlattener() const contractFlattener = new ContractFlattener()
@ -303,6 +307,7 @@ class AppComponent {
this.walkthroughService, this.walkthroughService,
search, search,
solidityumlgen, solidityumlgen,
compilationDetails,
contractFlattener, contractFlattener,
solidityScript, solidityScript,
openaigpt openaigpt

@ -0,0 +1,69 @@
import React from 'react'
import { ViewPlugin } from '@remixproject/engine-web'
import {PluginViewWrapper} from '@remix-ui/helper'
import { RemixAppManager } from '../../remixAppManager'
import { RemixUiCompileDetails } from '@remix-ui/solidity-compile-details'
const _paq = (window._paq = window._paq || [])
const profile = {
name: 'compilationdetails',
displayName: 'Solidity Compile Details',
description: 'Displays details from solidity compiler',
location: 'mainPanel',
methods: ['showDetails'],
events: []
}
export class CompilationDetailsPlugin extends ViewPlugin {
dispatch: React.Dispatch<any> = () => {}
appManager: RemixAppManager
element: HTMLDivElement
constructor(appManager: RemixAppManager) {
super(profile)
this.appManager = appManager
this.element = document.createElement('div')
this.element.setAttribute('id', 'compileDetails')
}
async onActivation() {
this.renderComponent()
await this.call('tabs', 'focus', 'compilationdetails')
}
onDeactivation(): void {
}
async showDetails() {
await this.call('tabs', 'focus', 'compilationdetails')
this.renderComponent()
}
setDispatch(dispatch: React.Dispatch<any>): void {
this.dispatch = dispatch
}
render() {
return (
<div id="compileDetails">
<PluginViewWrapper plugin={this} />
</div>
)
}
renderComponent() {
this.dispatch({
...this
})
}
updateComponent(state: any) {
return (
<RemixUiCompileDetails
plugin={this}
/>
)
}
}

@ -71,6 +71,7 @@ const requiredModules = [
'codeParser', 'codeParser',
'codeFormatter', 'codeFormatter',
'solidityumlgen', 'solidityumlgen',
'compilationDetails',
'contractflattener', 'contractflattener',
'solidity-script', 'solidity-script',
'openaigpt' 'openaigpt'

@ -0,0 +1 @@
export * from './lib/solidity-compile-details'

@ -0,0 +1,14 @@
import React from 'react'
export interface RemixUiCompileDetailsProps {
plugin: any
}
export function RemixUiCompileDetails({ plugin }: RemixUiCompileDetailsProps) {
return (
<>
<h1>Compile Details!!!</h1>
<h3>Every thing works fine.</h3>
</>
)
}

@ -37,8 +37,11 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
isFoundryProject, isFoundryProject,
workspaceName, workspaceName,
configFilePath, configFilePath,
setConfigFilePath setConfigFilePath,
//@ts-ignore
pluginProps
} = props // eslint-disable-line } = props // eslint-disable-line
console.log({ props })
const [state, setState] = useState({ const [state, setState] = useState({
hideWarnings: false, hideWarnings: false,
autoCompile: false, autoCompile: false,
@ -1179,6 +1182,15 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
</CopyToClipboard> </CopyToClipboard>
</div> </div>
</div> </div>
<button className="btn btn-primary btn-block" onClick={async () => {
// console.log('activatePlugin')
(pluginProps.api as any).call('compilationDetails', 'showDetails')
}}>
<span>
Show Details
</span>
</button>
</article> </article>
</section> </section>
) )

@ -13,6 +13,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
api, api,
api: {currentFile, compileTabLogic, configurationSettings} api: {currentFile, compileTabLogic, configurationSettings}
} = props } = props
console.log({ props })
const [state, setState] = useState({ const [state, setState] = useState({
isHardhatProject: false, isHardhatProject: false,
isTruffleProject: false, isTruffleProject: false,
@ -207,6 +208,8 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
<div id="compileTabView"> <div id="compileTabView">
<CompilerContainer <CompilerContainer
api={api} api={api}
//@ts-ignore
pluginProps={props}
isHardhatProject={state.isHardhatProject} isHardhatProject={state.isHardhatProject}
workspaceName={state.workspaceName} workspaceName={state.workspaceName}
isTruffleProject={state.isTruffleProject} isTruffleProject={state.isTruffleProject}

@ -8,6 +8,7 @@ export interface SolidityCompilerProps {
export interface CompilerContainerProps { export interface CompilerContainerProps {
api: ICompilerApi, api: ICompilerApi,
pluginProps: SolidityCompilerProps,
compileTabLogic: CompileTabLogic, compileTabLogic: CompileTabLogic,
isHardhatProject: boolean, isHardhatProject: boolean,
isTruffleProject: boolean, isTruffleProject: boolean,

@ -97,6 +97,9 @@
"@remix-ui/settings": [ "@remix-ui/settings": [
"libs/remix-ui/settings/src/index.ts" "libs/remix-ui/settings/src/index.ts"
], ],
"@remix-ui/solidity-compile-details": [
"libs/remix-ui/solidity-compile-details/src/index.ts"
],
"@remix-ui/solidity-compiler": [ "@remix-ui/solidity-compiler": [
"libs/remix-ui/solidity-compiler/src/index.ts" "libs/remix-ui/solidity-compiler/src/index.ts"
], ],
@ -153,7 +156,7 @@
], ],
"@remixproject/walletconnect-plugin": [ "@remixproject/walletconnect-plugin": [
"apps/walletconnect/src/index.ts" "apps/walletconnect/src/index.ts"
], ]
} }
} }
} }

Loading…
Cancel
Save