Get currentFile on compilation finished

pull/1339/head
ioedeveloper 3 years ago
parent a35b096c5e
commit 593c14c44a
  1. 4
      apps/remix-ide/src/app/tabs/analysis-tab.js
  2. 10
      apps/remix-ide/src/app/tabs/compile-tab.js
  3. 8
      libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx
  4. 4
      libs/remix-ui/solidity-compiler/src/lib/solidity-compiler.tsx
  5. 6
      libs/remix-ui/solidity-compiler/src/lib/types/index.ts

@ -4,7 +4,7 @@ import ReactDOM from 'react-dom'
import { EventEmitter } from 'events'
import {RemixUiStaticAnalyser} from '@remix-ui/static-analyser' // eslint-disable-line
import * as packageJson from '../../../../../package.json'
var Renderer = require('../ui/renderer')
// var Renderer = require('../ui/renderer')
var EventManager = require('../../lib/events')
@ -30,7 +30,7 @@ class AnalysisTab extends ViewPlugin {
this.element = document.createElement('div')
this.element.setAttribute('id', 'staticAnalyserView')
this._components = {
renderer: new Renderer(this)
// renderer: new Renderer(this)
}
this._components.registry = this.registry
this._deps = {

@ -85,10 +85,11 @@ class CompileTab extends ViewPlugin {
if (this._view.errorContainer) {
this._view.errorContainer.innerHTML = ''
}
this.compilerContainer.currentFile = ''
this.currentFile = ''
this.data.contractsDetails = {}
yo.update(this._view.contractSelection, this.contractSelection())
this.emit('statusChanged', { key: 'none' })
this.renderComponent()
}
/************
@ -137,12 +138,14 @@ class CompileTab extends ViewPlugin {
this.compileTabLogic.event.on('removeAnnotations', this.data.eventHandlers.onRemoveAnnotations)
this.data.eventHandlers.onCurrentFileChanged = (name) => {
this.compilerContainer.currentFile = name
this.currentFile = name
this.renderComponent()
}
this.fileManager.events.on('currentFileChanged', this.data.eventHandlers.onCurrentFileChanged)
this.data.eventHandlers.onNoFileSelected = () => {
this.compilerContainer.currentFile = ''
this.currentFile = ''
this.renderComponent()
}
this.fileManager.events.on('noFileSelected', this.data.eventHandlers.onNoFileSelected)
@ -499,6 +502,7 @@ class CompileTab extends ViewPlugin {
queryParams={this.queryParams}
plugin={this}
compileTabLogic={this.compileTabLogic}
compiledFileName={this.currentFile}
/>
, this.el)
}

@ -7,7 +7,7 @@ import { canUseWorker, baseURLBin, baseURLWasm, urlFromVersion, pathToURL, promi
import './css/style.css'
export const CompilerContainer = (props: CompilerContainerProps) => {
const { editor, config, queryParams, compileTabLogic, tooltip, modal } = props // eslint-disable-line
const { editor, config, queryParams, compileTabLogic, tooltip, modal, compiledFileName } = props // eslint-disable-line
const [state, setState] = useState({
hideWarnings: false,
autoCompile: false,
@ -60,6 +60,12 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
}
}, [compileTabLogic])
useEffect(() => {
setState(prevState => {
return { ...prevState, compiledFileName }
})
}, [compiledFileName])
const compilerLoaded = (version: string) => {
setVersionText(version)
}

@ -7,7 +7,7 @@ import { ModalDialog } from '@remix-ui/modal-dialog' // eslint-disable-line
import './css/style.css'
export const SolidityCompiler = (props: SolidityCompilerProps) => {
const { editor, config, queryParams, plugin, compileTabLogic } = props
const { editor, config, queryParams, plugin, compileTabLogic, compiledFileName } = props
const [state, setState] = useState({
contractsDetails: {},
eventHandlers: {},
@ -64,7 +64,7 @@ export const SolidityCompiler = (props: SolidityCompilerProps) => {
return (
<>
<div id="compileTabView">
<CompilerContainer editor={editor} config={config} queryParams={queryParams} compileTabLogic={compileTabLogic} tooltip={toast} modal={modal} />
<CompilerContainer editor={editor} config={config} queryParams={queryParams} compileTabLogic={compileTabLogic} tooltip={toast} modal={modal} compiledFileName={compiledFileName} />
{/* ${this._view.contractSelection} */}
<div className="remixui_errorBlobs p-4" data-id="compiledErrors"></div>
</div>

@ -7,7 +7,8 @@ export interface SolidityCompilerProps {
contentImport: any,
plugin: any,
queryParams: any,
compileTabLogic: any
compileTabLogic: any,
compiledFileName: string
}
export interface CompilerContainerProps {
@ -16,7 +17,8 @@ export interface CompilerContainerProps {
queryParams: any,
compileTabLogic: any,
tooltip: (message: string) => void,
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void
modal: (title: string, message: string | JSX.Element, okLabel: string, okFn: () => void, cancelLabel?: string, cancelFn?: () => void) => void,
compiledFileName: string
}
export interface ContractSelectionProps {
contractMap: {

Loading…
Cancel
Save