add footer and file/dir count

This commit is contained in:
joshuaboud 2021-05-27 16:22:08 -03:00
parent 72411a542d
commit fd1cbd101f
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E
3 changed files with 36 additions and 13 deletions

View File

@ -139,6 +139,10 @@ body::-webkit-scrollbar-thumb {
margin-bottom: 1em;
}
.spacer-stretchy {
flex-grow: 1;
}
.nav-hidden {
display: none;
}
@ -148,6 +152,7 @@ body::-webkit-scrollbar-thumb {
background-color: var(--container);
color: var(--font);
padding: 1em;
padding-bottom: 0;
}
.navigation-bar {
@ -291,11 +296,15 @@ body::-webkit-scrollbar-thumb {
background-color: var(--textarea-bg);
}
.nav-footer {
flex: 1;
align-items: baseline;
justify-content: flex-start;
padding: 5px;
}
.nav-toggle {
position: absolute;
right: 0;
bottom: 1.5em;
margin-right: 1.9em;
justify-self: flex-end;
}
.switch {

View File

@ -127,15 +127,21 @@
<button class="pf-c-button pf-m-primary" id="nav-apply-edit-btn"><i class="fas fa-save"></i></button>
</div>
</div>
<div class="nav-toggle">
<div class="nav-btn-group">
<i class="fas fa-sun" id="houston-theme-icon"></i>
<div class="horizontal-spacer-sm"></div>
<label class="switch">
<input type="checkbox" id="toggle-theme">
<span class="slider round"></span>
</label>
</div>
</div>
</div>
<div class="flex-row nav-footer">
<div>
<span id="nav-num-dirs">0</span> Directories, <span id="nav-num-files">0</span> Files
</div>
<div class="spacer-stretchy"></div>
<div class="nav-toggle">
<div class="nav-btn-group">
<i class="fas fa-sun" id="houston-theme-icon"></i>
<div class="horizontal-spacer-sm"></div>
<label class="switch">
<input type="checkbox" id="toggle-theme">
<span class="slider round"></span>
</label>
</div>
</div>
</div>

View File

@ -423,6 +423,8 @@ class NavWindow {
}
}
async refresh() {
var num_dirs = 0;
var num_files = 0;
this.start_load();
var files = await this.pwd().get_children(this);
while (this.entries.length) {
@ -430,12 +432,18 @@ class NavWindow {
entry.destroy();
}
files.forEach((file) => {
if (file.nav_type === "dir")
num_dirs++;
else
num_files++;
file.show();
this.entries.push(file);
});
document.getElementById("pwd").value = this.pwd().path_str();
this.set_selected(this.pwd());
this.show_selected_properties();
document.getElementById("nav-num-dirs").innerText = num_dirs.toString();
document.getElementById("nav-num-files").innerText = num_files.toString();
this.stop_load();
}
pwd() {