Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 0939476

Browse files
Fix bug: library manager webview should be responsive at different screens (#173)
* Fix bug: library manager webview should be responsive at different screens * Fix bug: c_cpp_properties.json cannot be saved * Make tslint happy
1 parent 10e6466 commit 0939476

File tree

7 files changed

+106
-49
lines changed

7 files changed

+106
-49
lines changed

html/app/components/BoardManager.tsx

+8-6
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,14 @@ class BoardManager extends React.Component<IBoardManagerProps, IBoardManagerStat
119119
)
120120
}
121121
<div className="arduinomanager-toolbar theme-bgcolor">
122-
<div className="dropdown-label">Type</div>
123-
<DropdownButton id="typeselector" title={this.state.category} onSelect={this.typeUpdate}>
124-
{ this.props.categories.map((c, index) => {
125-
return (<MenuItem key={index} eventKey={c} active={c === this.state.category}>{c}</MenuItem>);
126-
})}
127-
</DropdownButton>
122+
<div className="dropdown-filter">
123+
<span className="dropdown-label">Type</span>
124+
<DropdownButton id="typeselector" title={this.state.category} onSelect={this.typeUpdate}>
125+
{ this.props.categories.map((c, index) => {
126+
return (<MenuItem key={index} eventKey={c} active={c === this.state.category}>{c}</MenuItem>);
127+
})}
128+
</DropdownButton>
129+
</div>
128130
<SearchInput className="search-input" placeholder="Filter your search..." onChange={this.searchUpdate} />
129131
</div>
130132
<div className="arduinomanager-container">

html/app/components/LibraryManager.tsx

+16-12
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,22 @@ class LibraryManager extends React.Component<ILibraryManagerProps, ILibraryManag
145145
)
146146
}
147147
<div className="arduinomanager-toolbar theme-bgcolor">
148-
<div className="dropdown-label">Type</div>
149-
<DropdownButton id="typeselector" title={this.state.type} onSelect={this.typeUpdate}>
150-
{ this.props.types.map((c, index) => {
151-
return (<MenuItem key={index} eventKey={c} active={c === this.state.type}>{c}</MenuItem>);
152-
})}
153-
</DropdownButton>
154-
<div className="dropdown-label">Topic</div>
155-
<DropdownButton id="topicselector" title={this.state.topic} onSelect={this.topicUpdate}>
156-
{ this.props.categories.map((c, index) => {
157-
return (<MenuItem key={index} eventKey={c} active={c === this.state.topic}>{c}</MenuItem>);
158-
})}
159-
</DropdownButton>
148+
<div className="dropdown-filter">
149+
<span className="dropdown-label">Type</span>
150+
<DropdownButton id="typeselector" title={this.state.type} onSelect={this.typeUpdate}>
151+
{ this.props.types.map((c, index) => {
152+
return (<MenuItem key={index} eventKey={c} active={c === this.state.type}>{c}</MenuItem>);
153+
})}
154+
</DropdownButton>
155+
</div>
156+
<div className="dropdown-filter">
157+
<span className="dropdown-label">Topic</span>
158+
<DropdownButton id="topicselector" title={this.state.topic} onSelect={this.topicUpdate}>
159+
{ this.props.categories.map((c, index) => {
160+
return (<MenuItem key={index} eventKey={c} active={c === this.state.topic}>{c}</MenuItem>);
161+
})}
162+
</DropdownButton>
163+
</div>
160164
<SearchInput className="search-input" placeholder="Filter your search..." onChange={this.searchUpdate} />
161165
<Checkbox className="supported-checkbox" onChange={this.handleCheck}>Only show libraries supported by current board</Checkbox>
162166
</div>

html/app/styles/board.scss

+71-27
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,35 @@
2020

2121
.arduinomanager-toolbar {
2222
min-height: 60px;
23-
padding: 15px 10px;
23+
padding: 10px 10px;
2424
position: fixed;
2525
width: 100%;
2626
z-index: 100;
27+
}
28+
29+
.arduinomanager-container {
30+
padding-top: 60px;
31+
padding-bottom: 40px;
32+
}
33+
34+
.arduinomanager-footer {
35+
height: 40px;
36+
line-height: 40px;
37+
width: 100%;
38+
position: fixed;
39+
bottom: 0;
40+
padding: 0px 10px;
41+
}
42+
43+
.dropdown-filter {
44+
padding: 5px 5px;
45+
display: inline-block;
2746

2847
.dropdown-label {
29-
float: left;
30-
padding-top: 8px;
31-
margin: 0px 5px;
48+
margin-right: 5px;
3249
}
3350

3451
.dropdown {
35-
float: left;
3652
button {
3753
text-align: left;
3854
width: 150px;
@@ -54,20 +70,6 @@
5470
}
5571
}
5672

57-
.arduinomanager-container {
58-
padding-top: 60px;
59-
padding-bottom: 40px;
60-
}
61-
62-
.arduinomanager-footer {
63-
height: 40px;
64-
line-height: 40px;
65-
width: 100%;
66-
position: fixed;
67-
bottom: 0;
68-
padding: 0px 10px;
69-
}
70-
7173
a {
7274
color: lightseagreen;
7375
}
@@ -154,11 +156,18 @@ a {
154156
}
155157

156158
.boardmanager {
159+
.dropdown-filter {
160+
float: left;
161+
}
162+
157163
.search-input {
158-
margin-left: 190px;
159-
padding-top: 0px;
164+
margin-left: 195px;
160165
color: #333;
161166
}
167+
168+
.arduinomanager-container {
169+
padding-top: 55px;
170+
}
162171
}
163172

164173
.librarymanager {
@@ -167,18 +176,53 @@ a {
167176
}
168177

169178
.supported-checkbox {
170-
margin-top: -5px;
179+
margin-top: 5px;
171180
margin-bottom: 0px;
172181
padding-left: 5px;
173-
}
174182

175-
.arduinomanager-container {
176-
padding-top: 80px;
183+
label {
184+
text-overflow: ellipsis;
185+
overflow: hidden;
186+
white-space: nowrap;
187+
}
177188
}
178189

179190
.search-input {
180-
margin-left: 380px;
181-
padding-top: 0px;
182191
color: #333;
183192
}
193+
194+
@media only screen and (min-width: 560px) {
195+
.dropdown-filter {
196+
float: left;
197+
}
198+
199+
.search-input {
200+
margin-left: 400px;
201+
}
202+
203+
.arduinomanager-container {
204+
padding-top: 80px;
205+
}
206+
}
207+
208+
@media only screen and (max-width: 559px) {
209+
.dropdown-filter {
210+
display: inline-block;
211+
}
212+
213+
.arduinomanager-container {
214+
padding-top: 123px;
215+
}
216+
}
217+
218+
@media only screen and (max-width: 405px) {
219+
.dropdown-filter {
220+
display: block;
221+
}
222+
223+
.arduinomanager-container {
224+
padding-top: 167px;
225+
}
226+
}
184227
}
228+

html/app/styles/react-search-input.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.search-input {
2-
padding: 10px 10px;
2+
padding: 5px;
33
position: relative;
44
}
55

src/arduino/arduino.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class ArduinoApp {
129129
const configFilePath = path.join(vscode.workspace.rootPath, constants.CPP_CONFIG_FILE);
130130
let deviceContext = null;
131131
if (!util.fileExistsSync(configFilePath)) {
132-
util.mkdirRecursivelySync(configFilePath);
132+
util.mkdirRecursivelySync(path.dirname(configFilePath));
133133
deviceContext = {};
134134
} else {
135135
deviceContext = util.tryParseJSON(fs.readFileSync(configFilePath, "utf8"));

src/arduino/libraryManager.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ export class LibraryManager {
152152
if (librarySet.has(sourceLib.name)) {
153153
sourceLib.name = sourceLib.name + "(" + architecture + ")";
154154
}
155-
librarySet.add(sourceLib.name);
156-
builtInLib.push(sourceLib);
155+
if (!librarySet.has(sourceLib.name)) {
156+
librarySet.add(sourceLib.name);
157+
builtInLib.push(sourceLib);
158+
}
157159
}
158160
}
159161
return builtInLib;

src/common/util.ts

+5
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ export function readdirSync(dirPath: string, folderOnly: boolean = false): strin
6969
}
7070
}
7171

72+
/**
73+
* Recursively create directories. Equals to "mkdir -p"
74+
* @function mkdirRecursivelySync
75+
* @argument {string} dirPath
76+
*/
7277
export function mkdirRecursivelySync(dirPath: string): void {
7378
if (directoryExistsSync(dirPath)) {
7479
return ;

0 commit comments

Comments
 (0)