pluralize folder/file counts correctly in file list summary (#1701)
This commit is contained in:
@@ -2257,7 +2257,10 @@
|
|||||||
totalSize += file.size;
|
totalSize += file.size;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('folder-summary').innerHTML = `${folderCount} folders, ${files.length - folderCount} files, ${formatFileSize(totalSize)}`;
|
const fileCount = files.length - folderCount;
|
||||||
|
const folderLabel = folderCount === 1 ? 'folder' : 'folders';
|
||||||
|
const fileLabel = fileCount === 1 ? 'file' : 'files';
|
||||||
|
document.getElementById('folder-summary').innerHTML = `${folderCount} ${folderLabel}, ${fileCount} ${fileLabel}, ${formatFileSize(totalSize)}`;
|
||||||
|
|
||||||
if (files.length === 0) {
|
if (files.length === 0) {
|
||||||
fileTable.innerHTML = '<div class="no-files">This folder is empty</div>';
|
fileTable.innerHTML = '<div class="no-files">This folder is empty</div>';
|
||||||
|
|||||||
Reference in New Issue
Block a user