add no files

This commit is contained in:
matth@ultra 2024-09-01 23:46:58 +02:00
parent e8272ecca0
commit 2f6a213e6d

View File

@ -6,6 +6,7 @@ const mappings = new Map(JSON.parse(localStorage.getItem('mappings')) || []);
let statusLine = document.getElementById('status'); let statusLine = document.getElementById('status');
// store for when done with sorting TODO display // store for when done with sorting TODO display
let splash = document.getElementById('current-file').innerHTML; let splash = document.getElementById('current-file').innerHTML;
let noFiles = document.getElementById('file-list').innerHTML;
let history = []; let history = [];
@ -87,6 +88,10 @@ function renderMoveButtons() {
function renderFileList() { function renderFileList() {
const fileListDiv = document.getElementById('file-list'); const fileListDiv = document.getElementById('file-list');
if (fileList.length == 0) {
fileListDiv.innerHTML = noFiles;
return;
}
fileListDiv.innerHTML = ''; fileListDiv.innerHTML = '';
fileList.forEach(file => { fileList.forEach(file => {
const p = document.createElement('p'); const p = document.createElement('p');
@ -95,7 +100,7 @@ function renderFileList() {
classes += " selected-file-list-item"; classes += " selected-file-list-item";
} }
p.setAttribute("class", classes) p.setAttribute("class", classes)
p.innerHTML = file; p.textContent = file;
fileListDiv.appendChild(p); fileListDiv.appendChild(p);
}); });
} }