Reload pinned plugin

pull/4798/head
ioedeveloper 6 months ago
parent edc5fa26a0
commit e22ecedd00
  1. 14
      apps/remix-ide/src/app.js
  2. 4
      apps/remix-ide/src/app/components/pinned-panel.tsx
  3. 4
      apps/remix-ide/src/app/components/side-panel.tsx
  4. 4
      libs/remix-ui/panel/src/lib/plugins/panel-header.tsx

@ -571,6 +571,12 @@ class AppComponent {
}
}
}
}).then(async () => {
const lastPinned = localStorage.getItem('pinnedPlugin')
if (lastPinned) {
setTimeout(() => this.appManager.call('sidePanel', 'pinView', { name: lastPinned }), 500)
}
})
.catch(console.error)
}
@ -579,6 +585,14 @@ class AppComponent {
document.body.appendChild(loadedElement)
})
this.appManager.on('pinnedPanel', 'pinnedPlugin', (pluginName) => {
localStorage.setItem('pinnedPlugin', pluginName)
})
this.appManager.on('pinnedPanel', 'unPinnedPlugin', () => {
localStorage.setItem('pinnedPlugin', '')
})
// activate solidity plugin
this.appManager.activatePlugin(['solidity', 'udapp', 'deploy-libraries', 'link-libraries', 'openzeppelin-proxy'])
}

@ -41,16 +41,18 @@ export class PinnedPanel extends AbstractPanel {
this.plugins[profile.name].active = true
this.renderComponent()
this.events.emit('pinnedPlugin', profile.name)
this.emit('pinnedPlugin', profile.name)
}
async unPinView (profile) {
const activePlugin = this.currentFocus()
if (activePlugin !== profile.name) throw new Error(`Plugin ${profile.name} already pinned`)
if (activePlugin !== profile.name) throw new Error(`Plugin ${profile.name} is not pinned`)
await this.call('sidePanel', 'unPinView', profile, this.plugins[profile.name].view)
super.remove(profile.name)
this.renderComponent()
this.events.emit('unPinnedPlugin', profile.name)
this.emit('unPinnedPlugin', profile.name)
}
setDispatch (dispatch: React.Dispatch<any>) {

@ -72,8 +72,8 @@ export class SidePanel extends AbstractPanel {
this.renderComponent()
}
async pinView (profile, view) {
await this.call('pinnedPanel', 'pinView', profile, view)
async pinView (profile) {
await this.call('pinnedPanel', 'pinView', profile, this.plugins[profile.name].view)
this.removeView(profile)
}

@ -7,7 +7,7 @@ import {CustomTooltip, RenderIf, RenderIfNot} from '@remix-ui/helper'
export interface RemixPanelProps {
plugins: Record<string, PluginRecord>,
pinView?: (profile: PluginRecord['profile'], view: PluginRecord['view']) => void,
unPinView?: (profile: PluginRecord['profile'], view: PluginRecord['view']) => void
unPinView?: (profile: PluginRecord['profile']) => void
}
const RemixUIPanelHeader = (props: RemixPanelProps) => {
const [plugin, setPlugin] = useState<PluginRecord>()
@ -32,7 +32,7 @@ const RemixUIPanelHeader = (props: RemixPanelProps) => {
}
const unPinPlugin = () => {
props.unPinView && props.unPinView(plugin.profile, plugin.view)
props.unPinView && props.unPinView(plugin.profile)
}
const tooltipChild = <i className={`px-1 ml-2 pt-1 pb-2 ${!toggleExpander ? 'fas fa-angle-right' : 'fas fa-angle-down bg-light'}`} aria-hidden="true"></i>

Loading…
Cancel
Save