From ea645508a485ddedc6596540d6d916f48b96cb5d Mon Sep 17 00:00:00 2001 From: Joseph Izang Date: Mon, 16 Oct 2023 22:38:54 +0100 Subject: [PATCH] testing loading of mainpanel plugin --- apps/remix-ide/src/app.js | 5 ++ .../src/app/plugins/compile-details.tsx | 69 +++++++++++++++++++ apps/remix-ide/src/remixAppManager.js | 1 + .../solidity-compile-details/src/index.ts | 1 + .../src/lib/solidity-compile-details.tsx | 14 ++++ .../src/lib/compiler-container.tsx | 14 +++- .../src/lib/solidity-compiler.tsx | 3 + .../solidity-compiler/src/lib/types/index.ts | 1 + tsconfig.paths.json | 7 +- 9 files changed, 112 insertions(+), 3 deletions(-) create mode 100644 apps/remix-ide/src/app/plugins/compile-details.tsx create mode 100644 libs/remix-ui/solidity-compile-details/src/index.ts create mode 100644 libs/remix-ui/solidity-compile-details/src/lib/solidity-compile-details.tsx diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 3828448fe3..2f3a862a07 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -46,6 +46,7 @@ import {InjectedSKALEChaosTestnetProvider} from './app/providers/injected-skale- import {FileDecorator} from './app/plugins/file-decorator' import {CodeFormat} from './app/plugins/code-format' import {SolidityUmlGen} from './app/plugins/solidity-umlgen' +import { CompilationDetailsPlugin } from './app/plugins/compile-details' import {ContractFlattener} from './app/plugins/contractFlattener' import {OpenAIGpt} from './app/plugins/openaigpt' @@ -179,6 +180,9 @@ class AppComponent { //---------------- Solidity UML Generator ------------------------- const solidityumlgen = new SolidityUmlGen(appManager) + // ----------------- Compilation Details ---------------------------- + const compilationDetails = new CompilationDetailsPlugin(appManager) + // ----------------- ContractFlattener ---------------------------- const contractFlattener = new ContractFlattener() @@ -303,6 +307,7 @@ class AppComponent { this.walkthroughService, search, solidityumlgen, + compilationDetails, contractFlattener, solidityScript, openaigpt diff --git a/apps/remix-ide/src/app/plugins/compile-details.tsx b/apps/remix-ide/src/app/plugins/compile-details.tsx new file mode 100644 index 0000000000..1386554f4d --- /dev/null +++ b/apps/remix-ide/src/app/plugins/compile-details.tsx @@ -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 = () => {} + 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): void { + this.dispatch = dispatch + } + render() { + return ( +
+ +
+ ) + } + + renderComponent() { + this.dispatch({ + ...this + + }) + } + + updateComponent(state: any) { + return ( + + ) + } + +} diff --git a/apps/remix-ide/src/remixAppManager.js b/apps/remix-ide/src/remixAppManager.js index 8f31a868bc..8ad3ef9fc3 100644 --- a/apps/remix-ide/src/remixAppManager.js +++ b/apps/remix-ide/src/remixAppManager.js @@ -71,6 +71,7 @@ const requiredModules = [ 'codeParser', 'codeFormatter', 'solidityumlgen', + 'compilationDetails', 'contractflattener', 'solidity-script', 'openaigpt' diff --git a/libs/remix-ui/solidity-compile-details/src/index.ts b/libs/remix-ui/solidity-compile-details/src/index.ts new file mode 100644 index 0000000000..f695807697 --- /dev/null +++ b/libs/remix-ui/solidity-compile-details/src/index.ts @@ -0,0 +1 @@ +export * from './lib/solidity-compile-details' diff --git a/libs/remix-ui/solidity-compile-details/src/lib/solidity-compile-details.tsx b/libs/remix-ui/solidity-compile-details/src/lib/solidity-compile-details.tsx new file mode 100644 index 0000000000..4b56c2f92a --- /dev/null +++ b/libs/remix-ui/solidity-compile-details/src/lib/solidity-compile-details.tsx @@ -0,0 +1,14 @@ +import React from 'react' + +export interface RemixUiCompileDetailsProps { + plugin: any +} + +export function RemixUiCompileDetails({ plugin }: RemixUiCompileDetailsProps) { + return ( + <> +

Compile Details!!!

+

Every thing works fine.

+ + ) +} diff --git a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx index ab2355d8ca..e57b540f93 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -37,8 +37,11 @@ export const CompilerContainer = (props: CompilerContainerProps) => { isFoundryProject, workspaceName, configFilePath, - setConfigFilePath + setConfigFilePath, + //@ts-ignore + pluginProps } = props // eslint-disable-line + console.log({ props }) const [state, setState] = useState({ hideWarnings: false, autoCompile: false, @@ -1179,6 +1182,15 @@ export const CompilerContainer = (props: CompilerContainerProps) => { + ) diff --git a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx index 429fb093bd..0b9be26cb8 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx @@ -13,6 +13,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => { api, api: {currentFile, compileTabLogic, configurationSettings} } = props + console.log({ props }) const [state, setState] = useState({ isHardhatProject: false, isTruffleProject: false, @@ -207,6 +208,8 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {