From 979faa493e140bf8ee30f1df8ba222ae65677b44 Mon Sep 17 00:00:00 2001 From: Francesco Spissu <94986937+francescospissu@users.noreply.github.com> Date: Tue, 20 Sep 2022 17:20:40 +0200 Subject: [PATCH] retain install interface using version menu --- arduino-ide-extension/src/browser/style/list-widget.css | 4 ++-- .../widgets/component-list/component-list-item.tsx | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arduino-ide-extension/src/browser/style/list-widget.css b/arduino-ide-extension/src/browser/style/list-widget.css index f60159e34..f7cb7c938 100644 --- a/arduino-ide-extension/src/browser/style/list-widget.css +++ b/arduino-ide-extension/src/browser/style/list-widget.css @@ -131,7 +131,7 @@ flex-direction: column-reverse; } -.component-list-item:hover .footer > * { +.component-list-item .footer > * { display: inline-block; margin: 5px 0px 0px 10px; } @@ -160,4 +160,4 @@ .hc-black.hc-theia.theia-hc .component-list-item .header .installed:before { border: 1px solid var(--theia-button-border); -} \ No newline at end of file +} diff --git a/arduino-ide-extension/src/browser/widgets/component-list/component-list-item.tsx b/arduino-ide-extension/src/browser/widgets/component-list/component-list-item.tsx index 950df64bd..2024d48a7 100644 --- a/arduino-ide-extension/src/browser/widgets/component-list/component-list-item.tsx +++ b/arduino-ide-extension/src/browser/widgets/component-list/component-list-item.tsx @@ -15,6 +15,7 @@ export class ComponentListItem< this.state = { selectedVersion: version, focus: false, + versionUpdate: false, }; } } @@ -33,7 +34,9 @@ export class ComponentListItem< return (
this.setState({ focus: true })} - onMouseLeave={() => this.setState({ focus: false })} + onMouseLeave={() => { + if (!this.state.versionUpdate) this.setState({ focus: false }); + }} > {itemRenderer.renderItem( Object.assign(this.state, { item }), @@ -52,6 +55,7 @@ export class ComponentListItem< )[0]; this.setState({ selectedVersion: version, + versionUpdate: false, }); try { await this.props.install(item, toInstall); @@ -67,7 +71,7 @@ export class ComponentListItem< } private onVersionChange(version: Installable.Version): void { - this.setState({ selectedVersion: version }); + this.setState({ selectedVersion: version, versionUpdate: true }); } } @@ -83,5 +87,6 @@ export namespace ComponentListItem { export interface State { selectedVersion?: Installable.Version; focus: boolean; + versionUpdate: boolean; } }