feat: Remove 'Choose a folder' button from upload UI
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
@@ -319,7 +319,6 @@ async function uploadChunked(next){
|
|||||||
// --- DOM refs ---
|
// --- DOM refs ---
|
||||||
const dz = document.getElementById('dropzone');
|
const dz = document.getElementById('dropzone');
|
||||||
const fi = document.getElementById('fileInput');
|
const fi = document.getElementById('fileInput');
|
||||||
const foi = document.getElementById('folderInput');
|
|
||||||
const btnMobilePick = document.getElementById('btnMobilePick');
|
const btnMobilePick = document.getElementById('btnMobilePick');
|
||||||
const btnClearFinished = document.getElementById('btnClearFinished');
|
const btnClearFinished = document.getElementById('btnClearFinished');
|
||||||
const btnClearAll = document.getElementById('btnClearAll');
|
const btnClearAll = document.getElementById('btnClearAll');
|
||||||
@@ -442,9 +441,6 @@ fi.addEventListener('click', (e) => {
|
|||||||
// prevent bubbling to parents (extra safety)
|
// prevent bubbling to parents (extra safety)
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
});
|
});
|
||||||
if (foi) {
|
|
||||||
foi.addEventListener('click', (e) => { e.stopPropagation(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
const onFilesSelected = (inputEl) => {
|
const onFilesSelected = (inputEl) => {
|
||||||
if (!inputEl) return;
|
if (!inputEl) return;
|
||||||
@@ -461,7 +457,6 @@ const onFilesSelected = (inputEl) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fi.onchange = () => onFilesSelected(fi);
|
fi.onchange = () => onFilesSelected(fi);
|
||||||
if (foi) foi.onchange = () => onFilesSelected(foi);
|
|
||||||
|
|
||||||
// If you want the whole dropzone clickable on desktop only, enable this:
|
// If you want the whole dropzone clickable on desktop only, enable this:
|
||||||
if (!isTouch) {
|
if (!isTouch) {
|
||||||
|
|||||||
@@ -37,8 +37,7 @@
|
|||||||
<p class="mt-3 font-medium hidden md:block">Drop multiple files or folders here</p>
|
<p class="mt-3 font-medium hidden md:block">Drop multiple files or folders here</p>
|
||||||
<p class="mb-5 text-sm text-gray-600 dark:text-gray-400 hidden md:block">...or</p>
|
<p class="mb-5 text-sm text-gray-600 dark:text-gray-400 hidden md:block">...or</p>
|
||||||
|
|
||||||
<!-- Mobile-safe choose controls -->
|
<!-- Mobile-safe choose control: label wraps the hidden input -->
|
||||||
<div class="flex flex-col sm:flex-row items-center justify-center gap-y-10 sm:gap-y-0 sm:gap-x-4">
|
|
||||||
<div class="relative inline-block">
|
<div class="relative inline-block">
|
||||||
<label class="rounded-2xl bg-black text-white dark:bg-white dark:text-black px-5 py-3 hover:opacity-90 cursor-pointer select-none transition-colors" aria-label="Choose files">
|
<label class="rounded-2xl bg-black text-white dark:bg-white dark:text-black px-5 py-3 hover:opacity-90 cursor-pointer select-none transition-colors" aria-label="Choose files">
|
||||||
Choose files
|
Choose files
|
||||||
@@ -48,16 +47,6 @@
|
|||||||
class="absolute inset-0 opacity-0 cursor-pointer" />
|
class="absolute inset-0 opacity-0 cursor-pointer" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative inline-block">
|
|
||||||
<label class="rounded-2xl bg-black text-white dark:bg-white dark:text-black px-5 py-3 hover:opacity-90 cursor-pointer select-none transition-colors" aria-label="Choose a folder">
|
|
||||||
Choose a folder
|
|
||||||
<input id="folderInput"
|
|
||||||
type="file"
|
|
||||||
webkitdirectory
|
|
||||||
class="absolute inset-0 opacity-0 cursor-pointer" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Queue summary -->
|
<!-- Queue summary -->
|
||||||
|
|||||||
@@ -60,8 +60,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<p class="mt-3 font-medium hidden md:block">Drop multiple files or folders here</p>
|
<p class="mt-3 font-medium hidden md:block">Drop multiple files or folders here</p>
|
||||||
<p class="mb-5 text-sm text-gray-600 dark:text-gray-400 hidden md:block">...or</p>
|
<p class="mb-5 text-sm text-gray-600 dark:text-gray-400 hidden md:block">...or</p>
|
||||||
<!-- Mobile-safe choose controls -->
|
<!-- Mobile-safe choose control: label wraps the hidden input -->
|
||||||
<div class="flex flex-col sm:flex-row items-center justify-center gap-y-4 sm:gap-y-0 sm:gap-x-4">
|
|
||||||
<div class="relative inline-block">
|
<div class="relative inline-block">
|
||||||
<label class="rounded-2xl bg-black text-white dark:bg-white dark:text-black px-5 py-3 hover:opacity-90 cursor-pointer select-none transition-colors" aria-label="Choose files">
|
<label class="rounded-2xl bg-black text-white dark:bg-white dark:text-black px-5 py-3 hover:opacity-90 cursor-pointer select-none transition-colors" aria-label="Choose files">
|
||||||
Choose files
|
Choose files
|
||||||
@@ -71,16 +70,6 @@
|
|||||||
class="absolute inset-0 opacity-0 cursor-pointer" />
|
class="absolute inset-0 opacity-0 cursor-pointer" />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="relative inline-block">
|
|
||||||
<label class="rounded-2xl bg-black text-white dark:bg-white dark:text-black px-5 py-3 hover:opacity-90 cursor-pointer select-none transition-colors" aria-label="Choose a folder">
|
|
||||||
Choose a folder
|
|
||||||
<input id="folderInput"
|
|
||||||
type="file"
|
|
||||||
webkitdirectory
|
|
||||||
class="absolute inset-0 opacity-0 cursor-pointer" />
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mt-4 text-sm text-gray-500 dark:text-gray-400">
|
<div class="mt-4 text-sm text-gray-500 dark:text-gray-400">
|
||||||
Files will be uploaded to the selected album for this invite.
|
Files will be uploaded to the selected album for this invite.
|
||||||
</div>
|
</div>
|
||||||
@@ -131,7 +120,6 @@
|
|||||||
document.getElementById('liStatus').textContent = j.active ? 'Active' : ('Inactive' + (j.inactiveReason ? (' ('+j.inactiveReason+')') : ''));
|
document.getElementById('liStatus').textContent = j.active ? 'Active' : ('Inactive' + (j.inactiveReason ? (' ('+j.inactiveReason+')') : ''));
|
||||||
const dz = document.getElementById('dropzone');
|
const dz = document.getElementById('dropzone');
|
||||||
const fi = document.getElementById('fileInput');
|
const fi = document.getElementById('fileInput');
|
||||||
const foi = document.getElementById('folderInput');
|
|
||||||
const itemsEl = document.getElementById('items');
|
const itemsEl = document.getElementById('items');
|
||||||
const pwGate = document.getElementById('pwGate');
|
const pwGate = document.getElementById('pwGate');
|
||||||
if (j.passwordRequired && !j.authorized) {
|
if (j.passwordRequired && !j.authorized) {
|
||||||
@@ -139,7 +127,6 @@
|
|||||||
pwGate.classList.remove('hidden');
|
pwGate.classList.remove('hidden');
|
||||||
dz.classList.add('opacity-50');
|
dz.classList.add('opacity-50');
|
||||||
if (fi) fi.disabled = true;
|
if (fi) fi.disabled = true;
|
||||||
if (foi) foi.disabled = true;
|
|
||||||
itemsEl.innerHTML = '<div class="text-sm text-gray-500">Enter the password above to enable uploads.</div>';
|
itemsEl.innerHTML = '<div class="text-sm text-gray-500">Enter the password above to enable uploads.</div>';
|
||||||
// Wire unlock button
|
// Wire unlock button
|
||||||
const pwInput = document.getElementById('pwInput');
|
const pwInput = document.getElementById('pwInput');
|
||||||
@@ -156,7 +143,6 @@
|
|||||||
pwGate.classList.add('hidden');
|
pwGate.classList.add('hidden');
|
||||||
dz.classList.remove('opacity-50');
|
dz.classList.remove('opacity-50');
|
||||||
if (fi) fi.disabled = false;
|
if (fi) fi.disabled = false;
|
||||||
if (foi) foi.disabled = false;
|
|
||||||
itemsEl.innerHTML = '';
|
itemsEl.innerHTML = '';
|
||||||
try { showBanner('Password accepted. You can upload now.', 'ok'); } catch {}
|
try { showBanner('Password accepted. You can upload now.', 'ok'); } catch {}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -171,7 +157,6 @@
|
|||||||
// Disable dropzone
|
// Disable dropzone
|
||||||
dz.classList.add('opacity-50');
|
dz.classList.add('opacity-50');
|
||||||
fi.disabled = true;
|
fi.disabled = true;
|
||||||
if (foi) foi.disabled = true;
|
|
||||||
itemsEl.innerHTML = `<div class="text-sm text-gray-500">This link is not active${j.inactiveReason?` (${j.inactiveReason})`:''}.</div>`;
|
itemsEl.innerHTML = `<div class="text-sm text-gray-500">This link is not active${j.inactiveReason?` (${j.inactiveReason})`:''}.</div>`;
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|||||||
Reference in New Issue
Block a user