feat: Add "Download All" button and outside-click close to gallery

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-05-18 16:01:03 +00:00
parent d00e1dceeb
commit 2523410c84
2 changed files with 41 additions and 3 deletions

View File

@@ -548,7 +548,10 @@
<div class="max-w-6xl w-full h-[90vh] rounded-2xl bg-white dark:bg-gray-900 border dark:border-gray-700 p-4 flex flex-col">
<div class="flex items-center justify-between mb-2">
<div class="text-lg font-medium">Files</div>
<button class="dlgClose rounded-lg border px-2 py-1 text-xs dark:border-gray-600">Close</button>
<div class="flex items-center gap-2">
<a href="/api/files/zip/${path_b64}" class="rounded-lg border px-2 py-1 text-xs dark:border-gray-600">Download All</a>
<button class="dlgClose rounded-lg border px-2 py-1 text-xs dark:border-gray-600">Close</button>
</div>
</div>
<div class="flex-1 overflow-auto">
${files.length ? `<div class="grid grid-cols-2 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 gap-4">` + files.map(it => {
@@ -571,7 +574,10 @@
wrap.innerHTML = html;
const dlg = wrap.firstElementChild;
document.body.appendChild(dlg);
dlg.querySelectorAll('.dlgClose').forEach(b => b.onclick = () => { try { dlg.remove(); } catch {} });
const close = () => { try { dlg.remove(); } catch {} };
dlg.onclick = (e) => { if (e.target === e.currentTarget) close(); };
dlg.querySelectorAll('.dlgClose').forEach(b => b.onclick = close);
}
btnFilesRefresh.onclick = loadDirs;