Skip to content

Commit c1abbff

Browse files
authored
Merge pull request #81 from Kriechi/button-layout-and-folder-logging
Button layout and folder logging
2 parents 43b8772 + 46d4086 commit c1abbff

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

assets/js/workflows/usb.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class USBWorkflow extends Workflow {
199199
const fileClient = this.fileHelper.getFileClient();
200200
const changed = await fileClient.loadDirHandle(false);
201201
if (changed) {
202-
this._hostFolderChanged();
202+
await this._hostFolderChanged();
203203
}
204204
}
205205

@@ -208,15 +208,17 @@ class USBWorkflow extends Workflow {
208208
this.onConnected();
209209
}
210210

211-
_hostFolderChanged() {
211+
async _hostFolderChanged() {
212212
const fileClient = this.fileHelper.getFileClient();
213213
const folderName = fileClient.getWorkingDirectoryName();
214-
console.log(folderName);
214+
console.log("New folder name:", folderName);
215215
if (folderName) {
216216
// Set the working folder label
217217
lblWorkingfolder.innerHTML = folderName;
218218
btnUseHostFolder.classList.remove("hidden");
219-
btnSelectHostFolder.innerHTML = "Select New Folder";
219+
btnSelectHostFolder.innerHTML = "Select Different Folder";
220+
btnSelectHostFolder.classList.add("inverted");
221+
btnSelectHostFolder.classList.remove("first-item");
220222
}
221223
}
222224

@@ -246,11 +248,12 @@ class USBWorkflow extends Workflow {
246248
// At this point we should see if we should init the file client and check if have a saved dir handle
247249
this.initFileClient(new FileTransferClient(this.connectionStatus.bind(this), this._uid));
248250
const fileClient = this.fileHelper.getFileClient();
249-
console.log("Got file client");
250251
const result = await fileClient.loadSavedDirHandle();
251-
console.log(result);
252252
if (result) {
253-
this._hostFolderChanged();
253+
console.log("Successfully loaded directory:", fileClient.getWorkingDirectoryName());
254+
await this._hostFolderChanged();
255+
} else {
256+
console.log("Failed to load directory");
254257
}
255258
}
256259

assets/sass/base/_base.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ h5 {
6262
cursor: pointer;
6363
white-space: nowrap;
6464

65-
&:first-of-type {
65+
&:first-of-type, &.first-item {
6666
margin-left: 0;
6767
}
6868

69-
&:last-of-type {
69+
&:last-of-type, &.last-item {
7070
margin-right: 0;
7171
}
7272

index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ <h1>Select USB Host Folder</h1>
297297
<p>Select the root folder of your device. This is typically the CIRCUITPY Drive on your computer unless you renamed it. If your device does not appear as a drive on your computer, it will need to have the USB Host functionality enabled.</p>
298298
<p>
299299
<button class="purple-button hidden" id="useHostFolder">Use <span id="workingFolder"></span></button>
300-
<button class="purple-button" id="selectHostFolder">Select Working Folder</button>
300+
<button class="purple-button first-item" id="selectHostFolder">Select New Folder</button>
301301
</p>
302302
</div>
303303
</section>

0 commit comments

Comments
 (0)