From 6e4699ff9c40b33772ddafcca7ca4d78bf5b2bb4 Mon Sep 17 00:00:00 2001 From: Edouard Vanbelle Date: Sat, 9 May 2026 19:18:33 +0200 Subject: [PATCH] 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 --- static/js/app/ui.js | 10 ++++++++-- static/locales/ar.json | 4 +++- static/locales/de.json | 4 +++- static/locales/en.json | 4 +++- static/locales/es.json | 4 +++- static/locales/fa.json | 4 +++- static/locales/fr.json | 4 +++- static/locales/hi.json | 4 +++- static/locales/it.json | 4 +++- static/locales/ja.json | 4 +++- static/locales/ko.json | 4 +++- static/locales/nl.json | 4 +++- static/locales/pl.json | 4 +++- static/locales/pt.json | 4 +++- static/locales/ru.json | 4 +++- static/locales/zh.json | 4 +++- 16 files changed, 53 insertions(+), 17 deletions(-) diff --git a/static/js/app/ui.js b/static/js/app/ui.js index 10bf748a..6ac5201d 100644 --- a/static/js/app/ui.js +++ b/static/js/app/ui.js @@ -437,11 +437,11 @@ const ui = { }, 500); }); - // Document-wide drag and drop + // Document-wide drag and drop — only active in the Files section document.addEventListener('dragover', (e) => { e.preventDefault(); 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.add('active'); } @@ -466,6 +466,12 @@ const ui = { if (handledDropEvents.has(e)) 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) { // First try directory-aware extraction (Finder folder drag & drop) const droppedEntries = await collectDroppedEntries(e.dataTransfer); diff --git a/static/locales/ar.json b/static/locales/ar.json index 9b4a9d1e..aca16a60 100644 --- a/static/locales/ar.json +++ b/static/locales/ar.json @@ -443,7 +443,9 @@ "title": "الإشعارات", "empty": "لا توجد إشعارات", "link_created": "تم إنشاء الرابط", - "share_success": "تم إنشاء رابط المشاركة بنجاح" + "share_success": "تم إنشاء رابط المشاركة بنجاح", + "upload_files_section_title": "التحميل غير متاح هنا", + "upload_files_section_body": "انتقل إلى قسم الملفات لتحميل الملفات" }, "batch": { "one_selected": "عنصر واحد محدد", diff --git a/static/locales/de.json b/static/locales/de.json index d7574ae5..cefca7db 100644 --- a/static/locales/de.json +++ b/static/locales/de.json @@ -443,7 +443,9 @@ "title": "Benachrichtigungen", "empty": "Keine Benachrichtigungen", "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": { "one_selected": "1 Element ausgewählt", diff --git a/static/locales/en.json b/static/locales/en.json index d39c2aa3..46b13b95 100644 --- a/static/locales/en.json +++ b/static/locales/en.json @@ -443,7 +443,9 @@ "title": "Notifications", "empty": "No notifications", "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": { "one_selected": "1 item selected", diff --git a/static/locales/es.json b/static/locales/es.json index 26d7bab7..6c59eea2 100644 --- a/static/locales/es.json +++ b/static/locales/es.json @@ -443,7 +443,9 @@ "title": "Notificaciones", "empty": "Sin notificaciones", "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": { "one_selected": "1 elemento seleccionado", diff --git a/static/locales/fa.json b/static/locales/fa.json index 0ce76f48..34ea6b09 100644 --- a/static/locales/fa.json +++ b/static/locales/fa.json @@ -673,7 +673,9 @@ "title": "اعلان‌ها", "empty": "بدون اعلان", "link_created": "پیوند ایجاد شد", - "share_success": "پیوند اشتراک‌گذاری با موفقیت ایجاد شد" + "share_success": "پیوند اشتراک‌گذاری با موفقیت ایجاد شد", + "upload_files_section_title": "بارگذاری اینجا در دسترس نیست", + "upload_files_section_body": "برای بارگذاری فایل‌ها به بخش فایل‌ها بروید" }, "upload": { "uploading": "در حال آپلود...", diff --git a/static/locales/fr.json b/static/locales/fr.json index abfae6ed..d06fcf81 100644 --- a/static/locales/fr.json +++ b/static/locales/fr.json @@ -443,7 +443,9 @@ "empty": "No notifications", "title": "Notifications", "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": { "one_selected": "1 élément sélectionné", diff --git a/static/locales/hi.json b/static/locales/hi.json index 360e3e33..dc85c2e2 100644 --- a/static/locales/hi.json +++ b/static/locales/hi.json @@ -443,7 +443,9 @@ "title": "सूचनाएँ", "empty": "कोई सूचना नहीं", "link_created": "लिंक बनाया गया", - "share_success": "शेयर लिंक सफलतापूर्वक बनाया गया" + "share_success": "शेयर लिंक सफलतापूर्वक बनाया गया", + "upload_files_section_title": "यहाँ अपलोड उपलब्ध नहीं है", + "upload_files_section_body": "फ़ाइलें अपलोड करने के लिए फ़ाइलें अनुभाग पर जाएँ" }, "batch": { "one_selected": "1 आइटम चयनित", diff --git a/static/locales/it.json b/static/locales/it.json index f11ff4d0..04c96988 100644 --- a/static/locales/it.json +++ b/static/locales/it.json @@ -443,7 +443,9 @@ "empty": "No notifications", "title": "Notifications", "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": { "one_selected": "1 elemento selezionato", diff --git a/static/locales/ja.json b/static/locales/ja.json index 8744589f..eb7899b2 100644 --- a/static/locales/ja.json +++ b/static/locales/ja.json @@ -443,7 +443,9 @@ "title": "通知", "empty": "通知はありません", "link_created": "リンクを作成しました", - "share_success": "共有リンクを正常に作成しました" + "share_success": "共有リンクを正常に作成しました", + "upload_files_section_title": "ここではアップロードできません", + "upload_files_section_body": "ファイルをアップロードするには「ファイル」セクションに移動してください" }, "batch": { "one_selected": "1件選択中", diff --git a/static/locales/ko.json b/static/locales/ko.json index 80a3663e..663ab4a1 100644 --- a/static/locales/ko.json +++ b/static/locales/ko.json @@ -443,7 +443,9 @@ "title": "알림", "empty": "알림이 없습니다", "link_created": "링크 생성됨", - "share_success": "공유 링크가 성공적으로 생성되었습니다" + "share_success": "공유 링크가 성공적으로 생성되었습니다", + "upload_files_section_title": "여기서는 업로드할 수 없습니다", + "upload_files_section_body": "파일을 업로드하려면 파일 섹션으로 이동하세요" }, "batch": { "one_selected": "1개 선택됨", diff --git a/static/locales/nl.json b/static/locales/nl.json index 8e582422..582b43bd 100644 --- a/static/locales/nl.json +++ b/static/locales/nl.json @@ -443,7 +443,9 @@ "title": "Notificaties", "empty": "Geen notificaties", "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": { "one_selected": "1 item geselecteerd", diff --git a/static/locales/pl.json b/static/locales/pl.json index b746fbdc..1000580e 100644 --- a/static/locales/pl.json +++ b/static/locales/pl.json @@ -443,7 +443,9 @@ "title": "Powiadomienia", "empty": "Brak powiadomień", "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": { "one_selected": "Wybrano 1 element", diff --git a/static/locales/pt.json b/static/locales/pt.json index ced7be8e..3629935b 100644 --- a/static/locales/pt.json +++ b/static/locales/pt.json @@ -443,7 +443,9 @@ "empty": "No notifications", "title": "Notifications", "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": { "one_selected": "1 item selecionado", diff --git a/static/locales/ru.json b/static/locales/ru.json index 0524a294..5451bad5 100644 --- a/static/locales/ru.json +++ b/static/locales/ru.json @@ -443,7 +443,9 @@ "title": "Уведомления", "empty": "Нет уведомлений", "link_created": "Ссылка создана", - "share_success": "Ссылка для общего доступа успешно создана" + "share_success": "Ссылка для общего доступа успешно создана", + "upload_files_section_title": "Загрузка здесь недоступна", + "upload_files_section_body": "Перейдите в раздел «Файлы», чтобы загрузить файлы" }, "batch": { "one_selected": "Выбран 1 элемент", diff --git a/static/locales/zh.json b/static/locales/zh.json index c8eb1aae..70cef715 100644 --- a/static/locales/zh.json +++ b/static/locales/zh.json @@ -673,7 +673,9 @@ "title": "通知", "empty": "暂无通知", "link_created": "链接已创建", - "share_success": "分享链接创建成功" + "share_success": "分享链接创建成功", + "upload_files_section_title": "此处不支持上传", + "upload_files_section_body": "请前往文件部分上传文件" }, "upload": { "uploading": "正在上传...",