Skip to content

Commit eaa2653

Browse files
fstasiAlberto Iannaccone
authored and
Alberto Iannaccone
committed
show sketchbook commands on hover
1 parent cf5e22d commit eaa2653

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

Diff for: arduino-ide-extension/src/browser/style/sketchbook.css

+9
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,12 @@
3636
#arduino-sketchbook-tree-widget .theia-TreeNodeSegmentGrow {
3737
flex: 1;
3838
}
39+
40+
.theia-TreeNode .sketchbook-commands-icons {
41+
display: none;
42+
}
43+
44+
.theia-TreeNode:hover .sketchbook-commands-icons,
45+
.theia-TreeNode.theia-mod-selected .sketchbook-commands-icons {
46+
display: block;
47+
}

Diff for: arduino-ide-extension/src/browser/widgets/cloud-sketchbook/cloud-sketchbook-tree-widget.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,8 @@ export class CloudSketchbookTreeWidget extends SketchbookTreeWidget {
8686
return classNames;
8787
}
8888

89-
protected renderInlineCommands(node: any, props: NodeProps): React.ReactNode {
90-
if (
91-
CloudSketchbookTree.CloudSketchDirNode.is(node) &&
92-
node.commands &&
93-
(node.id === this.hoveredNodeId ||
94-
this.currentSketchUri === node.uri.toString())
95-
) {
89+
protected renderInlineCommands(node: any): React.ReactNode {
90+
if (CloudSketchbookTree.CloudSketchDirNode.is(node) && node.commands) {
9691
return Array.from(new Set(node.commands)).map((command) =>
9792
this.renderInlineCommand(command.id, node, {
9893
username: this.authenticationService.session?.account?.label,

Diff for: arduino-ide-extension/src/browser/widgets/sketchbook/sketchbook-tree-widget.tsx

+4-10
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class SketchbookTreeWidget extends FileTreeWidget {
8484
return (
8585
<React.Fragment>
8686
{super.renderTailDecorations(node, props)}
87-
{this.renderInlineCommands(node, props)}
87+
{this.renderInlineCommands(node)}
8888
</React.Fragment>
8989
);
9090
}
@@ -107,15 +107,8 @@ export class SketchbookTreeWidget extends FileTreeWidget {
107107
};
108108
}
109109

110-
protected renderInlineCommands(
111-
node: TreeNode,
112-
props: NodeProps
113-
): React.ReactNode {
114-
if (
115-
SketchbookTree.SketchDirNode.is(node) &&
116-
((node.commands && node.id === this.hoveredNodeId) ||
117-
this.currentSketchUri === node?.uri.toString())
118-
) {
110+
protected renderInlineCommands(node: TreeNode): React.ReactNode {
111+
if (SketchbookTree.SketchDirNode.is(node) && node.commands) {
119112
return Array.from(new Set(node.commands)).map((command) =>
120113
this.renderInlineCommand(command.id, node)
121114
);
@@ -142,6 +135,7 @@ export class SketchbookTreeWidget extends FileTreeWidget {
142135
TREE_NODE_TAIL_CLASS,
143136
icon,
144137
'theia-tree-view-inline-action',
138+
'sketchbook-commands-icons',
145139
].join(' ');
146140
return (
147141
<div

0 commit comments

Comments
 (0)