Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions apps/remix-ide-e2e/src/tests/pinned_plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ module.exports = {
.click('*[data-id="restoreClosedPlugin"]')
.waitForElementVisible('*[data-pinnedplugin="movePluginToLeft-solidity"]')
},
'Close Solidity Compiler Plugin, reload IDE, it should be closed and restore it #group1': function (browser: NightwatchBrowser) {
browser
.waitForElementVisible('*[data-id="closePinnedPlugin"]')
.click('*[data-id="closePinnedPlugin"]')
.waitForElementNotVisible('*[data-pinnedplugin="movePluginToLeft-solidity"]')
.waitForElementVisible('*[data-id="restoreClosedPlugin"')
.refresh()
.waitForElementVisible('*[data-id="restoreClosedPlugin"')
.click('*[data-id="restoreClosedPlugin"]')
.waitForElementVisible('*[data-pinnedplugin="movePluginToLeft-solidity"]')
},
'Swap pinned Solidity Compiler Plugin with RemixAI Assistant when pinned plugin is closed #group1': function (browser: NightwatchBrowser) {
browser
.refreshPage()
Expand Down
19 changes: 17 additions & 2 deletions apps/remix-ide/src/app/components/pinned-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const pinnedPanel = {
export class PinnedPanel extends AbstractPanel {
dispatch: React.Dispatch<any> = () => {}
loggedState: Record<string, any>
pinnedPanelState: Record<string, any> // pluginProfile, isClosed
highlightStamp: number
closedPlugin: any

Expand All @@ -36,6 +37,9 @@ export class PinnedPanel extends AbstractPanel {
super.remove(name)
}
})

const pinnedPanelState = window.localStorage.getItem('pinnedPanelState')
if (!pinnedPanelState) window.localStorage.setItem('pinnedPanelState', JSON.stringify({}))
}

async pinView (profile, view) {
Expand All @@ -53,9 +57,18 @@ export class PinnedPanel extends AbstractPanel {
this.addView(profile, view)
this.plugins[profile.name].pinned = true
this.plugins[profile.name].active = true
let pinnedPanelState = window.localStorage.getItem('pinnedPanelState')
let isClosed = false
if (pinnedPanelState) {
pinnedPanelState = JSON.parse(pinnedPanelState)
if (pinnedPanelState['isClosed']) {
isClosed = true
await this.closePlugin(profile)
}
}
this.renderComponent()
this.events.emit('pinnedPlugin', profile)
this.emit('pinnedPlugin', profile)
this.events.emit('pinnedPlugin', profile, isClosed)
this.emit('pinnedPlugin', profile, isClosed)
}

async unPinView (profile) {
Expand All @@ -77,6 +90,7 @@ export class PinnedPanel extends AbstractPanel {
const pinnedPanel = document.querySelector('#pinned-panel')
pinnedPanel.classList.add('d-none')
this.closedPlugin = profile
window.localStorage.setItem('pinnedPanelState', JSON.stringify({ pluginProfile: profile, isClosed: true }))
this.events.emit('pluginClosed', profile)
this.emit('pluginClosed', profile)
}
Expand All @@ -85,6 +99,7 @@ export class PinnedPanel extends AbstractPanel {
const pinnedPanel = document.querySelector('#pinned-panel')
pinnedPanel.classList.remove('d-none')
this.closedPlugin = null
window.localStorage.setItem('pinnedPanelState', JSON.stringify({ pluginProfile: profile, isClosed: false }))
this.events.emit('pluginMaximized', profile)
this.emit('pluginMaximized', profile)
}
Expand Down
4 changes: 2 additions & 2 deletions libs/remix-ui/app/src/lib/remix-app/remix-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ const RemixApp = (props: IRemixAppUi) => {
setLocale(nextLocale)
})

props.app.pinnedPanel.events.on('pinnedPlugin', () => {
setHidePinnedPanel(false)
props.app.pinnedPanel.events.on('pinnedPlugin', (profile, isClosed) => {
if (!isClosed) setHidePinnedPanel(false)
})

props.app.pinnedPanel.events.on('unPinnedPlugin', () => {
Expand Down