Resolve Opus review code findings

This commit is contained in:
“Naeel”
2026-09-05 13:11:25 +03:00
parent edf1de5aa2
commit 13ea0efcd7
5 changed files with 25 additions and 26 deletions
@@ -57,11 +57,6 @@ export function initUploadTable(cfg) {
state.fileKeys.clear();
render(state, elements);
},
setBusy: (busy) => {
state.busy = busy;
elements.fileInputEl.disabled = busy;
elements.folderInputEl.disabled = busy;
},
};
api.render();
return api;
+1 -7
View File
@@ -1,14 +1,8 @@
import { listZipFiles } from '../zip/list_zip_files.js';
import { addFileWithDedup } from './add_file_with_dedup.js';
import { rebaseTree } from './rebase_tree.js';
import { render } from './render.js';
function rebaseTree(root, prefix) {
root.path = `${prefix}/${root.path}`;
if (root.file) root.file = new File([root.file], root.path, { lastModified: root.file.lastModified });
root.children.forEach((child) => rebaseTree(child, prefix));
return root;
}
export function onFolderChange(state, cfg, elements) {
return async () => {
if (state.busy) return;
+6
View File
@@ -0,0 +1,6 @@
export function rebaseTree(root, prefix) {
root.path = `${prefix}/${root.path}`;
if (root.file) root.file = new File([root.file], root.path, { lastModified: root.file.lastModified });
root.children.forEach((child) => rebaseTree(child, prefix));
return root;
}
+1 -7
View File
@@ -1,4 +1,5 @@
// Построить дерево ZIP с файлами только разрешённых расширений.
import { rebaseTree } from '../table/rebase_tree.js';
function extensionAllowed(name, allowedExt) {
const lowerName = name.toLowerCase();
@@ -20,13 +21,6 @@ function node(kind, name, path, children = [], file = null) {
return { id: crypto.randomUUID(), kind, name, path, children, file, expanded: true };
}
function rebaseTree(root, prefix) {
root.path = `${prefix}/${root.path}`;
if (root.file) root.file = new File([root.file], root.path, { lastModified: root.file.lastModified });
root.children.forEach((child) => rebaseTree(child, prefix));
return root;
}
function addPath(root, parts, fileNode) {
let current = root;
parts.forEach((part, index) => {