From 7e6e920233f1b86b53af8c9d0270a4820870a124 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Tue, 18 Jan 2022 18:35:57 +0100 Subject: [PATCH] terminal hide --- apps/remix-ide/src/app/panels/layout.ts | 3 ++- libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx | 1 + libs/remix-ui/panel/src/lib/main/main-panel.tsx | 12 +++++++++++- libs/remix-ui/terminal/src/lib/remix-ui-terminal.tsx | 10 ++++++++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/remix-ide/src/app/panels/layout.ts b/apps/remix-ide/src/app/panels/layout.ts index 451c2aefe7..663692db26 100644 --- a/apps/remix-ide/src/app/panels/layout.ts +++ b/apps/remix-ide/src/app/panels/layout.ts @@ -80,7 +80,8 @@ export class Layout extends Plugin { const params = queryParams.get() if (params.minimizeterminal || params.embed) { this.panels.terminal.minimized = true - this.event.emit('change', null) + this.event.emit('change', this.panels) + this.emit('change', this.panels) } if (params.minimizesidepanel || params.embed) { this.event.emit('minimizesidepanel') diff --git a/libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx b/libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx index 232f23ff10..116630c64c 100644 --- a/libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx +++ b/libs/remix-ui/panel/src/lib/dragbar/dragbar.tsx @@ -20,6 +20,7 @@ const DragBar = (props: IRemixDragBarUi) => { props.refObject.current.setAttribute('style', `height: ${h}px;`) setDragBarPosY(window.innerHeight - props.refObject.current.offsetHeight) setDragState(false) + props.setHideStatus(false) } const handleResize = () => { setDragBarPosY(window.innerHeight - props.refObject.current.offsetHeight) diff --git a/libs/remix-ui/panel/src/lib/main/main-panel.tsx b/libs/remix-ui/panel/src/lib/main/main-panel.tsx index 4fb00ddf65..4ea7dc20f2 100644 --- a/libs/remix-ui/panel/src/lib/main/main-panel.tsx +++ b/libs/remix-ui/panel/src/lib/main/main-panel.tsx @@ -37,14 +37,24 @@ const RemixUIMainPanel = () => { appContext.layout.event.on('change', () => { renderPanels() }) + + return () => { + appContext.layout.event.off('change') + } }, []) + const showTerminal = (hide: boolean) => { + appContext.layout.panels.terminal.minimized = hide + appContext.layout.event.emit('change', appContext.layout.panels) + appContext.layout.emit('change', appContext.layout.panels) + } + return (
{Object.values(plugins).map((pluginRecord, i) => { return ( - {(pluginRecord.profile.name === 'terminal') ? : null} + {(pluginRecord.profile.name === 'terminal') ? : null} { props.plugin.call('layout', 'minimize', props.plugin.profile.name, isOpen) } + useEffect(() => { + props.plugin.on('layout', 'change', (panels) => { + setIsOpen(!panels.terminal.minimized) + }) + + return () => { + props.plugin.off('layout', 'change') + } + }, []) + const classNameBlock = 'remix_ui_terminal_block px-4 py-1 text-break' return (