Skip to content

fix board selection and workspace input dialogs width and height #1406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class BoardsConfigDialog extends AbstractDialog<BoardsConfig.Config> {
) {
super({ ...props, maxWidth: 500 });

this.node.id = 'select-board-dialog-container';
this.contentNode.classList.add('select-board-dialog');
this.contentNode.appendChild(this.createDescription());

Expand Down
38 changes: 24 additions & 14 deletions arduino-ide-extension/src/browser/boards/boards-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,18 @@ export class BoardsConfig extends React.Component<
}
}

const boardsList = Array.from(distinctBoards.values()).map((board) => (
<Item<BoardWithPackage>
key={toKey(board)}
item={board}
label={board.name}
details={board.details}
selected={board.selected}
onClick={this.selectBoard}
missing={board.missing}
/>
));

return (
<React.Fragment>
<div className="search">
Expand All @@ -315,19 +327,17 @@ export class BoardsConfig extends React.Component<
/>
<i className="fa fa-search"></i>
</div>
<div className="boards list">
{Array.from(distinctBoards.values()).map((board) => (
<Item<BoardWithPackage>
key={toKey(board)}
item={board}
label={board.name}
details={board.details}
selected={board.selected}
onClick={this.selectBoard}
missing={board.missing}
/>
))}
</div>
{boardsList.length > 0 ? (
<div className="boards list">{boardsList}</div>
) : (
<div className="no-result">
{nls.localize(
'arduino/board/noBoardsFound',
'No boards found for "{0}"',
query
)}
</div>
)}
</React.Fragment>
);
}
Expand All @@ -342,7 +352,7 @@ export class BoardsConfig extends React.Component<
);
}
return !ports.length ? (
<div className="loading noselect">
<div className="no-result">
{nls.localize('arduino/board/noPortsDiscovered', 'No ports discovered')}
</div>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export class AdditionalUrlsDialog extends AbstractDialog<string[]> {

this.textArea = document.createElement('textarea');
this.textArea.className = 'theia-input';
this.textArea.setAttribute('style', 'flex: 0;');
this.textArea.value = urls
.filter((url) => url.trim())
.filter((url) => !!url)
Expand Down
21 changes: 21 additions & 0 deletions arduino-ide-extension/src/browser/style/boards-config-dialog.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#select-board-dialog-container > .dialogBlock {
width: 640px;
height: 500px;
}

div#select-board-dialog {
margin: 5px;
height: 100%;
}

div#select-board-dialog .selectBoardContainer {
display: flex;
gap: 10px;
overflow: hidden;
max-height: 100%;
height: 100%;
}

.select-board-dialog .head {
margin: 5px;
}

.dialogContent.select-board-dialog {
height: 100%;
}

div.dialogContent.select-board-dialog > div.head .title {
font-weight: 400;
letter-spacing: 0.02em;
Expand Down Expand Up @@ -63,6 +74,7 @@ div#select-board-dialog .selectBoardContainer .list .item.selected i {
display: flex;
flex-direction: column;
max-height: 100%;
height: 100%;
}

#select-board-dialog .selectBoardContainer .left.container .content {
Expand Down Expand Up @@ -131,6 +143,7 @@ div#select-board-dialog .selectBoardContainer .list .item.selected i {
#select-board-dialog .selectBoardContainer .list {
max-height: 200px;
overflow-y: auto;
flex: 1;
}

#select-board-dialog .selectBoardContainer .ports.list {
Expand Down Expand Up @@ -282,3 +295,11 @@ div#select-board-dialog .selectBoardContainer .list .item.selected i {
display: none;
}
}

#select-board-dialog .no-result {
text-transform: uppercase;
height: 100%;
user-select: none;
padding: 10px 5px;
overflow-wrap: break-word;
}
4 changes: 3 additions & 1 deletion arduino-ide-extension/src/browser/style/dialogs.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
total = padding + margin = 96px
*/
max-width: calc(100% - 96px) !important;
min-width: unset;

min-width: 424px;
max-height: 560px;
padding: 0 28px;
}
Expand Down Expand Up @@ -85,3 +86,4 @@
max-height: 400px;
}
}

6 changes: 4 additions & 2 deletions arduino-ide-extension/src/browser/style/settings-dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@
}

.additional-urls-dialog textarea {
width: 100%;
resize: none;
}

.p-Widget.dialogOverlay .dialogBlock .dialogContent.additional-urls-dialog {
display: block;
display: flex;
overflow: hidden;
padding: 0 1px;
margin: 0 -1px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
SketchesServiceClientImpl,
} from '../../../common/protocol/sketches-service-client-impl';
import { SaveAsSketch } from '../../contributions/save-as-sketch';
import { SingleTextInputDialog } from '@theia/core/lib/browser';
import { nls } from '@theia/core/lib/common';

@injectable()
Expand Down Expand Up @@ -161,20 +160,26 @@ export class WorkspaceCommandContribution extends TheiaWorkspaceCommandContribut
return;
}
const initialValue = uri.path.base;
const dialog = new SingleTextInputDialog({
title: nls.localize('theia/workspace/newFileName', 'New name for file'),
initialValue,
initialSelectionRange: {
start: 0,
end: uri.path.name.length,
},
validate: (name, mode) => {
if (initialValue === name && mode === 'preview') {
return false;
}
return this.validateFileName(name, parent, false);
const parentUri = parent.resource;

const dialog = new WorkspaceInputDialog(
{
title: nls.localize('theia/workspace/newFileName', 'New name for file'),
initialValue,
parentUri,
initialSelectionRange: {
start: 0,
end: uri.path.name.length,
},
validate: (name, mode) => {
if (initialValue === name && mode === 'preview') {
return false;
}
return this.validateFileName(name, parent, false);
},
},
});
this.labelProvider
);
const newName = await dialog.open();
const newNameWithExt = this.maybeAppendInoExt(newName);
if (newNameWithExt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class WorkspaceInputDialog extends TheiaWorkspaceInputDialog {
protected override readonly labelProvider: LabelProvider
) {
super(props, labelProvider);
this.node.classList.add('workspace-input-dialog');
this.appendCloseButton(
nls.localize('vscode/issueMainService/cancel', 'Cancel')
);
Expand Down
1 change: 1 addition & 0 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"getBoardInfo": "Get Board Info",
"inSketchbook": " (in Sketchbook)",
"installNow": "The \"{0} {1}\" core has to be installed for the currently selected \"{2}\" board. Do you want to install it now?",
"noBoardsFound": "No boards found for \"{0}\"",
"noFQBN": "The FQBN is not available for the selected board \"{0}\". Do you have the corresponding core installed?",
"noPortsDiscovered": "No ports discovered",
"noPortsSelected": "No ports selected for board: '{0}'.",
Expand Down