Skip to content

Commit 7bb8ab4

Browse files
author
Alberto Iannaccone
committed
rework board config UI to make it scale up better
1 parent 7a12159 commit 7bb8ab4

File tree

6 files changed

+60
-51
lines changed

6 files changed

+60
-51
lines changed

Diff for: arduino-ide-extension/src/browser/arduino-ide-frontend-module.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,10 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
453453
bind(BoardsConfigDialogWidget).toSelf().inSingletonScope();
454454
bind(BoardsConfigDialog).toSelf().inSingletonScope();
455455
bind(BoardsConfigDialogProps).toConstantValue({
456-
title: nls.localize('arduino/common/selectBoard', 'Select Board'),
456+
title: nls.localize(
457+
'arduino/board/boardConfigDialogTitle',
458+
'Select other board and port'
459+
),
457460
});
458461

459462
// Core service

Diff for: arduino-ide-extension/src/browser/boards/boards-config-dialog.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
1+
import {
2+
injectable,
3+
inject,
4+
postConstruct,
5+
} from '@theia/core/shared/inversify';
26
import { Message } from '@theia/core/shared/@phosphor/messaging';
37
import { DialogProps, Widget, DialogError } from '@theia/core/lib/browser';
48
import { AbstractDialog } from '../theia/dialogs/dialogs';
@@ -28,7 +32,7 @@ export class BoardsConfigDialog extends AbstractDialog<BoardsConfig.Config> {
2832
@inject(BoardsConfigDialogProps)
2933
protected override readonly props: BoardsConfigDialogProps
3034
) {
31-
super(props);
35+
super({ ...props, maxWidth: 500 });
3236

3337
this.contentNode.classList.add('select-board-dialog');
3438
this.contentNode.appendChild(this.createDescription());
@@ -65,14 +69,6 @@ export class BoardsConfigDialog extends AbstractDialog<BoardsConfig.Config> {
6569
const head = document.createElement('div');
6670
head.classList.add('head');
6771

68-
const title = document.createElement('div');
69-
title.textContent = nls.localize(
70-
'arduino/board/configDialogTitle',
71-
'Select Other Board & Port'
72-
);
73-
title.classList.add('title');
74-
head.appendChild(title);
75-
7672
const text = document.createElement('div');
7773
text.classList.add('text');
7874
head.appendChild(text);

Diff for: arduino-ide-extension/src/browser/boards/boards-config.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,14 @@ export class BoardsConfig extends React.Component<
258258

259259
override render(): React.ReactNode {
260260
return (
261-
<div className="body">
261+
<>
262262
{this.renderContainer('boards', this.renderBoards.bind(this))}
263263
{this.renderContainer(
264264
'ports',
265265
this.renderPorts.bind(this),
266266
this.renderPortsFooter.bind(this)
267267
)}
268-
</div>
268+
</>
269269
);
270270
}
271271

Diff for: arduino-ide-extension/src/browser/boards/boards-toolbar-item.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class BoardsDropDown extends React.Component<BoardsDropDown.Props> {
8989
className="arduino-boards-dropdown-item arduino-board-dropdown-footer"
9090
onClick={() => this.props.openBoardsConfig()}
9191
>
92-
<div>{footerLabel}</div>
92+
<div>{footerLabel}...</div>
9393
</div>
9494
</div>
9595
);

Diff for: arduino-ide-extension/src/browser/style/boards-config-dialog.css

+46-35
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ div#select-board-dialog {
22
margin: 5px;
33
}
44

5-
div#select-board-dialog .selectBoardContainer .body {
5+
div#select-board-dialog .selectBoardContainer {
66
display: flex;
7+
gap: 10px;
78
overflow: hidden;
9+
max-height: 100%;
810
}
911

1012
.select-board-dialog .head {
@@ -19,12 +21,13 @@ div.dialogContent.select-board-dialog > div.head .title {
1921
margin-bottom: 10px;
2022
}
2123

22-
div#select-board-dialog .selectBoardContainer .body .list .item.selected {
24+
25+
div#select-board-dialog .selectBoardContainer .list .item.selected {
2326
background: var(--theia-secondaryButton-hoverBackground);
2427
}
2528

26-
div#select-board-dialog .selectBoardContainer .body .list .item.selected i {
27-
color: var(--theia-list-activeSelectionIconForeground);
29+
div#select-board-dialog .selectBoardContainer .list .item.selected i {
30+
color: var(--theia-arduino-branding-primary);
2831
}
2932

3033
#select-board-dialog .selectBoardContainer .search,
@@ -34,7 +37,7 @@ div#select-board-dialog .selectBoardContainer .body .list .item.selected i {
3437
background: var(--theia-editor-background);
3538
}
3639

37-
#select-board-dialog .selectBoardContainer .body .search input {
40+
#select-board-dialog .selectBoardContainer .search input {
3841
border: none;
3942
width: 100%;
4043
height: auto;
@@ -46,58 +49,63 @@ div#select-board-dialog .selectBoardContainer .body .list .item.selected i {
4649
color: var(--theia-input-foreground);
4750
}
4851

49-
#select-board-dialog .selectBoardContainer .body .search input:focus {
52+
#select-board-dialog .selectBoardContainer .search input:focus {
5053
box-shadow: none;
5154
}
5255

53-
#select-board-dialog .selectBoardContainer .body .container {
56+
#select-board-dialog .selectBoardContainer .container {
5457
flex: 1;
55-
padding: 0px 10px 0px 0px;
56-
min-width: 240px;
57-
max-width: 240px;
58+
overflow: hidden;
59+
max-height: 100%;
60+
}
61+
62+
#select-board-dialog .selectBoardContainer .container .content {
63+
display: flex;
64+
flex-direction: column;
65+
max-height: 100%;
5866
}
5967

60-
#select-board-dialog .selectBoardContainer .body .left.container .content {
68+
#select-board-dialog .selectBoardContainer .left.container .content {
6169
margin: 0 5px 0 0;
6270
}
6371

64-
#select-board-dialog .selectBoardContainer .body .right.container .content {
72+
#select-board-dialog .selectBoardContainer .right.container .content {
6573
margin: 0 0 0 5px;
6674
}
6775

68-
#select-board-dialog .selectBoardContainer .body .container .content .title {
76+
#select-board-dialog .selectBoardContainer .container .content .title {
6977
color: var(--theia-editorWidget-foreground);
7078
padding: 0px 0px 10px 0px;
7179
text-transform: uppercase;
7280
}
7381

74-
#select-board-dialog .selectBoardContainer .body .container .content .footer {
82+
#select-board-dialog .selectBoardContainer .container .content .footer {
7583
padding: 10px 5px 10px 0px;
7684
}
7785

78-
#select-board-dialog .selectBoardContainer .body .container .content .loading {
86+
#select-board-dialog .selectBoardContainer .container .content .loading {
7987
font-size: var(--theia-ui-font-size1);
8088
color: var(--theia-editorWidget-foreground);
8189
padding: 10px 5px 10px 10px;
8290
text-transform: uppercase;
83-
/* The max, min-height comes from `.body .list` 200px + 47px top padding - 2 * 10px top padding */
91+
/* The max, min-height comes from `.list` 200px + 47px top padding - 2 * 10px top padding */
8492
max-height: 227px;
8593
min-height: 227px;
8694
}
8795

88-
#select-board-dialog .selectBoardContainer .body .list .item {
96+
#select-board-dialog .selectBoardContainer .list .item {
8997
padding: 10px 5px 10px 10px;
9098
display: flex;
91-
justify-content: end;
9299
white-space: nowrap;
93100
overflow-x: hidden;
101+
flex: 1 0;
94102
}
95103

96-
#select-board-dialog .selectBoardContainer .body .list .item .selected-icon {
104+
#select-board-dialog .selectBoardContainer .list .item .selected-icon {
97105
margin-left: auto;
98106
}
99107

100-
#select-board-dialog .selectBoardContainer .body .list .item .details {
108+
#select-board-dialog .selectBoardContainer .list .item .details {
101109
font-size: var(--theia-ui-font-size1);
102110
opacity: var(--theia-mod-disabled-opacity);
103111
width: 155px; /* used heuristics for the calculation */
@@ -106,43 +114,36 @@ div#select-board-dialog .selectBoardContainer .body .list .item.selected i {
106114
text-overflow: ellipsis;
107115
}
108116

109-
#select-board-dialog .selectBoardContainer .body .list .item.missing {
117+
#select-board-dialog .selectBoardContainer .list .item.missing {
110118
opacity: var(--theia-mod-disabled-opacity);
111119
}
112120

113-
#select-board-dialog .selectBoardContainer .body .list .item:hover {
121+
#select-board-dialog .selectBoardContainer .list .item:hover {
114122
background: var(--theia-secondaryButton-hoverBackground);
115123
}
116124

117-
#select-board-dialog .selectBoardContainer .body .list .label {
118-
max-width: 215px;
119-
width: 215px;
125+
#select-board-dialog .selectBoardContainer .list .label {
120126
white-space: pre;
121127
overflow: hidden;
122128
text-overflow: ellipsis;
123129
}
124130

125-
#select-board-dialog .selectBoardContainer .body .list {
131+
#select-board-dialog .selectBoardContainer .list {
126132
max-height: 200px;
127-
min-height: 200px;
128133
overflow-y: auto;
129134
}
130135

131-
#select-board-dialog .selectBoardContainer .body .ports.list {
136+
#select-board-dialog .selectBoardContainer .ports.list {
132137
margin: 47px 0px 0px 0px; /* 47 is 37 as input height for the `Boards`, plus 10 margin bottom. */
133138
}
134139

135-
#select-board-dialog .selectBoardContainer .body .search {
140+
#select-board-dialog .selectBoardContainer .search {
136141
margin-bottom: 10px;
137142
display: flex;
138143
align-items: center;
139144
padding-right: 5px;
140145
}
141146

142-
.p-Widget.dialogOverlay .dialogContent.select-board-dialog {
143-
width: 500px;
144-
}
145-
146147
.arduino-boards-toolbar-item-container {
147148
align-items: center;
148149
background: var(--theia-arduino-toolbar-dropdown-background);
@@ -264,10 +265,20 @@ div#select-board-dialog .selectBoardContainer .body .list .item.selected i {
264265

265266
/* High Contrast Theme rules */
266267
/* TODO: Remove it when the Theia version is upgraded to 1.27.0 and use Theia APIs to implement it*/
267-
.hc-black.hc-theia.theia-hc #select-board-dialog .selectBoardContainer .body .list .item:hover {
268+
.hc-black.hc-theia.theia-hc #select-board-dialog .selectBoardContainer .list .item:hover {
268269
outline: 1px dashed var(--theia-focusBorder);
269270
}
270271

271-
.hc-black.hc-theia.theia-hc div#select-board-dialog .selectBoardContainer .body .list .item.selected {
272+
.hc-black.hc-theia.theia-hc div#select-board-dialog .selectBoardContainer .list .item.selected {
272273
outline: 1px solid var(--theia-focusBorder);
273274
}
275+
276+
@media only screen and (max-height: 400px) {
277+
div.dialogContent.select-board-dialog > div.head {
278+
display: none;
279+
}
280+
281+
#select-board-dialog .selectBoardContainer .container .content .title {
282+
display: none;
283+
}
284+
}

Diff for: i18n/en.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
},
77
"board": {
88
"board": "Board{0}",
9+
"boardConfigDialogTitle": "Select other board and port",
910
"boardInfo": "Board Info",
1011
"configDialog1": "Select both a Board and a Port if you want to upload a sketch.",
1112
"configDialog2": "If you only select a Board you will be able to compile, but not to upload your sketch.",
12-
"configDialogTitle": "Select Other Board & Port",
1313
"couldNotFindPreviouslySelected": "Could not find previously selected board '{0}' in installed platform '{1}'. Please manually reselect the board you want to use. Do you want to reselect it now?",
1414
"disconnected": "Disconnected",
1515
"getBoardInfo": "Get Board Info",
@@ -107,7 +107,6 @@
107107
"offlineIndicator": "You appear to be offline. Without an Internet connection, the Arduino CLI might not be able to download the required resources and could cause malfunction. Please connect to the Internet and restart the application.",
108108
"oldFormat": "The '{0}' still uses the old `.pde` format. Do you want to switch to the new `.ino` extension?",
109109
"processing": "Processing",
110-
"selectBoard": "Select Board",
111110
"selectedOn": "on {0}",
112111
"serialMonitor": "Serial Monitor",
113112
"unknown": "Unknown"

0 commit comments

Comments
 (0)