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; margin-bottom: 1em;
} }
.spacer-stretchy {
flex-grow: 1;
}
.nav-hidden { .nav-hidden {
display: none; display: none;
} }
@ -148,6 +152,7 @@ body::-webkit-scrollbar-thumb {
background-color: var(--container); background-color: var(--container);
color: var(--font); color: var(--font);
padding: 1em; padding: 1em;
padding-bottom: 0;
} }
.navigation-bar { .navigation-bar {
@ -291,11 +296,15 @@ body::-webkit-scrollbar-thumb {
background-color: var(--textarea-bg); background-color: var(--textarea-bg);
} }
.nav-footer {
flex: 1;
align-items: baseline;
justify-content: flex-start;
padding: 5px;
}
.nav-toggle { .nav-toggle {
position: absolute; justify-self: flex-end;
right: 0;
bottom: 1.5em;
margin-right: 1.9em;
} }
.switch { .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> <button class="pf-c-button pf-m-primary" id="nav-apply-edit-btn"><i class="fas fa-save"></i></button>
</div> </div>
</div> </div>
<div class="nav-toggle"> </div>
<div class="nav-btn-group"> </div>
<i class="fas fa-sun" id="houston-theme-icon"></i> <div class="flex-row nav-footer">
<div class="horizontal-spacer-sm"></div> <div>
<label class="switch"> <span id="nav-num-dirs">0</span> Directories, <span id="nav-num-files">0</span> Files
<input type="checkbox" id="toggle-theme"> </div>
<span class="slider round"></span> <div class="spacer-stretchy"></div>
</label> <div class="nav-toggle">
</div> <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>
</div> </div>

View File

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