feat(ui): drop from system available only on files section

* prevent dropzone if not on files section
 * show a notification to user to use files section
 * solve #357
This commit is contained in:
Edouard Vanbelle
2026-05-09 19:18:33 +02:00
parent a6eb81a13a
commit 6e4699ff9c
16 changed files with 53 additions and 17 deletions
+8 -2
View File
@@ -437,11 +437,11 @@ const ui = {
}, 500); }, 500);
}); });
// Document-wide drag and drop // Document-wide drag and drop — only active in the Files section
document.addEventListener('dragover', (e) => { document.addEventListener('dragover', (e) => {
e.preventDefault(); e.preventDefault();
if (!e.dataTransfer) return; if (!e.dataTransfer) return;
if (e.dataTransfer.types.includes('Files')) { if (e.dataTransfer.types.includes('Files') && app.currentSection === 'files') {
dropzone?.classList.remove('hidden'); dropzone?.classList.remove('hidden');
dropzone?.classList.add('active'); dropzone?.classList.add('active');
} }
@@ -466,6 +466,12 @@ const ui = {
if (handledDropEvents.has(e)) return; if (handledDropEvents.has(e)) return;
if (!e.dataTransfer) return; if (!e.dataTransfer) return;
if (app.currentSection !== 'files') {
if (e.dataTransfer.types.includes('Files')) {
this.showNotification(i18n.t('notifications.upload_files_section_title'), i18n.t('notifications.upload_files_section_body'));
}
return;
}
if (e.dataTransfer.files.length > 0) { if (e.dataTransfer.files.length > 0) {
// First try directory-aware extraction (Finder folder drag & drop) // First try directory-aware extraction (Finder folder drag & drop)
const droppedEntries = await collectDroppedEntries(e.dataTransfer); const droppedEntries = await collectDroppedEntries(e.dataTransfer);
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "الإشعارات", "title": "الإشعارات",
"empty": "لا توجد إشعارات", "empty": "لا توجد إشعارات",
"link_created": "تم إنشاء الرابط", "link_created": "تم إنشاء الرابط",
"share_success": "تم إنشاء رابط المشاركة بنجاح" "share_success": "تم إنشاء رابط المشاركة بنجاح",
"upload_files_section_title": "التحميل غير متاح هنا",
"upload_files_section_body": "انتقل إلى قسم الملفات لتحميل الملفات"
}, },
"batch": { "batch": {
"one_selected": "عنصر واحد محدد", "one_selected": "عنصر واحد محدد",
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "Benachrichtigungen", "title": "Benachrichtigungen",
"empty": "Keine Benachrichtigungen", "empty": "Keine Benachrichtigungen",
"link_created": "Link erstellt", "link_created": "Link erstellt",
"share_success": "Freigabelink erfolgreich erstellt" "share_success": "Freigabelink erfolgreich erstellt",
"upload_files_section_title": "Upload hier nicht verfügbar",
"upload_files_section_body": "Wechseln Sie zum Abschnitt Dateien, um Dateien hochzuladen"
}, },
"batch": { "batch": {
"one_selected": "1 Element ausgewählt", "one_selected": "1 Element ausgewählt",
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "Notifications", "title": "Notifications",
"empty": "No notifications", "empty": "No notifications",
"link_created": "Link created", "link_created": "Link created",
"share_success": "Shared link created successfully" "share_success": "Shared link created successfully",
"upload_files_section_title": "Upload not available here",
"upload_files_section_body": "Go to the Files section to upload files"
}, },
"batch": { "batch": {
"one_selected": "1 item selected", "one_selected": "1 item selected",
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "Notificaciones", "title": "Notificaciones",
"empty": "Sin notificaciones", "empty": "Sin notificaciones",
"link_created": "Enlace creado", "link_created": "Enlace creado",
"share_success": "Enlace compartido creado correctamente" "share_success": "Enlace compartido creado correctamente",
"upload_files_section_title": "Subida no disponible aquí",
"upload_files_section_body": "Ve a la sección Archivos para subir archivos"
}, },
"batch": { "batch": {
"one_selected": "1 elemento seleccionado", "one_selected": "1 elemento seleccionado",
+3 -1
View File
@@ -673,7 +673,9 @@
"title": "اعلان‌ها", "title": "اعلان‌ها",
"empty": "بدون اعلان", "empty": "بدون اعلان",
"link_created": "پیوند ایجاد شد", "link_created": "پیوند ایجاد شد",
"share_success": "پیوند اشتراک‌گذاری با موفقیت ایجاد شد" "share_success": "پیوند اشتراک‌گذاری با موفقیت ایجاد شد",
"upload_files_section_title": "بارگذاری اینجا در دسترس نیست",
"upload_files_section_body": "برای بارگذاری فایل‌ها به بخش فایل‌ها بروید"
}, },
"upload": { "upload": {
"uploading": "در حال آپلود...", "uploading": "در حال آپلود...",
+3 -1
View File
@@ -443,7 +443,9 @@
"empty": "No notifications", "empty": "No notifications",
"title": "Notifications", "title": "Notifications",
"link_created": "Lien créé", "link_created": "Lien créé",
"share_success": "Lien de partage créé avec succès" "share_success": "Lien de partage créé avec succès",
"upload_files_section_title": "Dépôt non disponible ici",
"upload_files_section_body": "Accédez à la section Fichiers pour déposer des fichiers"
}, },
"batch": { "batch": {
"one_selected": "1 élément sélectionné", "one_selected": "1 élément sélectionné",
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "सूचनाएँ", "title": "सूचनाएँ",
"empty": "कोई सूचना नहीं", "empty": "कोई सूचना नहीं",
"link_created": "लिंक बनाया गया", "link_created": "लिंक बनाया गया",
"share_success": "शेयर लिंक सफलतापूर्वक बनाया गया" "share_success": "शेयर लिंक सफलतापूर्वक बनाया गया",
"upload_files_section_title": "यहाँ अपलोड उपलब्ध नहीं है",
"upload_files_section_body": "फ़ाइलें अपलोड करने के लिए फ़ाइलें अनुभाग पर जाएँ"
}, },
"batch": { "batch": {
"one_selected": "1 आइटम चयनित", "one_selected": "1 आइटम चयनित",
+3 -1
View File
@@ -443,7 +443,9 @@
"empty": "No notifications", "empty": "No notifications",
"title": "Notifications", "title": "Notifications",
"link_created": "Link creato", "link_created": "Link creato",
"share_success": "Link di condivisione creato con successo" "share_success": "Link di condivisione creato con successo",
"upload_files_section_title": "Caricamento non disponibile qui",
"upload_files_section_body": "Vai alla sezione File per caricare i file"
}, },
"batch": { "batch": {
"one_selected": "1 elemento selezionato", "one_selected": "1 elemento selezionato",
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "通知", "title": "通知",
"empty": "通知はありません", "empty": "通知はありません",
"link_created": "リンクを作成しました", "link_created": "リンクを作成しました",
"share_success": "共有リンクを正常に作成しました" "share_success": "共有リンクを正常に作成しました",
"upload_files_section_title": "ここではアップロードできません",
"upload_files_section_body": "ファイルをアップロードするには「ファイル」セクションに移動してください"
}, },
"batch": { "batch": {
"one_selected": "1件選択中", "one_selected": "1件選択中",
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "알림", "title": "알림",
"empty": "알림이 없습니다", "empty": "알림이 없습니다",
"link_created": "링크 생성됨", "link_created": "링크 생성됨",
"share_success": "공유 링크가 성공적으로 생성되었습니다" "share_success": "공유 링크가 성공적으로 생성되었습니다",
"upload_files_section_title": "여기서는 업로드할 수 없습니다",
"upload_files_section_body": "파일을 업로드하려면 파일 섹션으로 이동하세요"
}, },
"batch": { "batch": {
"one_selected": "1개 선택됨", "one_selected": "1개 선택됨",
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "Notificaties", "title": "Notificaties",
"empty": "Geen notificaties", "empty": "Geen notificaties",
"link_created": "Link aangemaakt", "link_created": "Link aangemaakt",
"share_success": "Deellink succesvol aangemaakt" "share_success": "Deellink succesvol aangemaakt",
"upload_files_section_title": "Uploaden hier niet beschikbaar",
"upload_files_section_body": "Ga naar de sectie Bestanden om bestanden te uploaden"
}, },
"batch": { "batch": {
"one_selected": "1 item geselecteerd", "one_selected": "1 item geselecteerd",
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "Powiadomienia", "title": "Powiadomienia",
"empty": "Brak powiadomień", "empty": "Brak powiadomień",
"link_created": "Link utworzony", "link_created": "Link utworzony",
"share_success": "Link udostępniania utworzony pomyślnie" "share_success": "Link udostępniania utworzony pomyślnie",
"upload_files_section_title": "Przesyłanie niedostępne tutaj",
"upload_files_section_body": "Przejdź do sekcji Pliki, aby przesłać pliki"
}, },
"batch": { "batch": {
"one_selected": "Wybrano 1 element", "one_selected": "Wybrano 1 element",
+3 -1
View File
@@ -443,7 +443,9 @@
"empty": "No notifications", "empty": "No notifications",
"title": "Notifications", "title": "Notifications",
"link_created": "Link criado", "link_created": "Link criado",
"share_success": "Link de partilha criado com sucesso" "share_success": "Link de partilha criado com sucesso",
"upload_files_section_title": "Upload não disponível aqui",
"upload_files_section_body": "Vá para a seção Arquivos para enviar arquivos"
}, },
"batch": { "batch": {
"one_selected": "1 item selecionado", "one_selected": "1 item selecionado",
+3 -1
View File
@@ -443,7 +443,9 @@
"title": "Уведомления", "title": "Уведомления",
"empty": "Нет уведомлений", "empty": "Нет уведомлений",
"link_created": "Ссылка создана", "link_created": "Ссылка создана",
"share_success": "Ссылка для общего доступа успешно создана" "share_success": "Ссылка для общего доступа успешно создана",
"upload_files_section_title": "Загрузка здесь недоступна",
"upload_files_section_body": "Перейдите в раздел «Файлы», чтобы загрузить файлы"
}, },
"batch": { "batch": {
"one_selected": "Выбран 1 элемент", "one_selected": "Выбран 1 элемент",
+3 -1
View File
@@ -673,7 +673,9 @@
"title": "通知", "title": "通知",
"empty": "暂无通知", "empty": "暂无通知",
"link_created": "链接已创建", "link_created": "链接已创建",
"share_success": "分享链接创建成功" "share_success": "分享链接创建成功",
"upload_files_section_title": "此处不支持上传",
"upload_files_section_body": "请前往文件部分上传文件"
}, },
"upload": { "upload": {
"uploading": "正在上传...", "uploading": "正在上传...",