Skip to content

Commit bb27d6e

Browse files
committed
show terminal on a log
1 parent b86aa6d commit bb27d6e

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

apps/remix-ide-e2e/src/tests/toggle_panels.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,23 @@ module.exports = {
154154
.click('*[data-id="toggleBottomPanelIcon"]')
155155
.waitForElementVisible('.terminal-wrap')
156156
},
157+
'Terminal panel automatically unhides when log is added #group1': function (browser: NightwatchBrowser) {
158+
browser
159+
.waitForElementVisible('.terminal-wrap')
160+
.click('*[data-id="hideBottomPanel"]')
161+
.waitForElementNotVisible('.terminal-wrap')
162+
.waitForElementVisible('.codicon-layout-panel-off')
163+
// Execute a script that will generate a log
164+
.addFile('test_log.ts', { content: 'console.log("test")' })
165+
.pause(1000)
166+
.clickLaunchIcon('solidity')
167+
.pause(1000)
168+
.click('*[data-id="compile-action"]') // run script
169+
.pause(2000)
170+
// Terminal should automatically unhide when compilation logs are generated
171+
.waitForElementVisible('.terminal-wrap')
172+
.waitForElementVisible('.codicon-layout-panel')
173+
},
157174
'Hide all three panels using toggle icons on top bar, reload and ensure all are hidden #group1': function (browser: NightwatchBrowser) {
158175
browser
159176
.waitForElementVisible('*[data-id="toggleLeftSidePanelIcon"]')

apps/remix-ide/src/app/panels/terminal.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,36 @@ export default class Terminal extends Plugin {
145145
}
146146

147147
logHtml(html) {
148+
// Unhide terminal panel if it's hidden when a log is added
149+
if (this.isHidden) {
150+
this.showPanel()
151+
}
148152
this.terminalApi.logHtml(html)
149153
}
150154

151155
log(message, type) {
156+
// Unhide terminal panel if it's hidden when a log is added
157+
if (this.isHidden) {
158+
this.showPanel()
159+
}
152160
this.terminalApi.log(message, type)
153161
}
154162

163+
showPanel() {
164+
const terminalPanel = document.querySelector('.terminal-wrap')
165+
this.isHidden = false
166+
terminalPanel?.classList.remove('d-none')
167+
this.emit('terminalPanelShown')
168+
169+
// Persist the state
170+
const panelStates = JSON.parse(window.localStorage.getItem('panelStates') || '{}')
171+
panelStates.bottomPanel = {
172+
isHidden: this.isHidden,
173+
pluginProfile: this.profile
174+
}
175+
window.localStorage.setItem('panelStates', JSON.stringify(panelStates))
176+
}
177+
155178
togglePanel() {
156179
const terminalPanel = document.querySelector('.terminal-wrap')
157180
if (this.isHidden) {

0 commit comments

Comments
 (0)