diff --git a/crates/in-web/src/drive.rs b/crates/in-web/src/drive.rs
index 1980342..7d43456 100644
--- a/crates/in-web/src/drive.rs
+++ b/crates/in-web/src/drive.rs
@@ -375,6 +375,9 @@ async fn drive(cx: &Cx) -> Result {
// none via the file-upload-input rule.
+ if listing.files.is_empty() {
+
for file in listing.files.iter() {
@@ -561,6 +564,23 @@ async fn upload_script(cx: &Cx) -> Result {
focusIt(); \
document.addEventListener('in:wire', focusIt); \
})(); \
+ (function () { \
+ if (window.__inDrop) { return; } \
+ window.__inDrop = true; \
+ function uploadForm() { return document.getElementById('upload-form'); } \
+ document.addEventListener('dragover', function (e) { \
+ if (uploadForm() && e.dataTransfer && e.dataTransfer.types && Array.prototype.indexOf.call(e.dataTransfer.types, 'Files') !== -1) { e.preventDefault(); } \
+ }); \
+ document.addEventListener('drop', function (e) { \
+ var form = uploadForm(); \
+ if (!form || !e.dataTransfer || !e.dataTransfer.files || !e.dataTransfer.files.length) { return; } \
+ e.preventDefault(); \
+ var input = form.querySelector('.file-upload-input'); \
+ if (!input) { return; } \
+ input.files = e.dataTransfer.files; \
+ input.dispatchEvent(new Event('change', { bubbles: true })); \
+ }); \
+ })(); \
})();";
view! { cx => }
}
diff --git a/crates/in-web/src/i18n.rs b/crates/in-web/src/i18n.rs
index 08d9260..0bf704f 100644
--- a/crates/in-web/src/i18n.rs
+++ b/crates/in-web/src/i18n.rs
@@ -105,6 +105,7 @@ pub enum Key {
MoveFolder,
DeleteFolder,
EmptyFolder,
+ EmptyFiles,
FoldersHeading,
FilesHeading,
NameColumn,
@@ -217,6 +218,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
MoveFolder => "Move folder",
DeleteFolder => "Delete folder",
EmptyFolder => "This folder is empty.",
+ EmptyFiles => "Nothing here yet — press + to upload, or drop files on this page.",
FoldersHeading => "Folders",
FilesHeading => "Files",
NameColumn => "Name",
@@ -318,6 +320,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
MoveFolder => "Klasörü taşı",
DeleteFolder => "Klasörü sil",
EmptyFolder => "Bu klasör boş.",
+ EmptyFiles => "Henüz bir şey yok — + ile yükle ya da dosyaları bu sayfaya bırak.",
FoldersHeading => "Klasörler",
FilesHeading => "Dosyalar",
NameColumn => "Ad",
diff --git a/crates/in-web/tests/http.rs b/crates/in-web/tests/http.rs
index 6e59934..bdf4173 100644
--- a/crates/in-web/tests/http.rs
+++ b/crates/in-web/tests/http.rs
@@ -2703,3 +2703,18 @@ async fn drive_edit_row_renders_the_rename_form() {
assert!(body.contains("value=\"plans\""), "rename input is not pre-filled");
assert!(body.contains("__inEditFocus"), "no edit focus script");
}
+
+#[tokio::test]
+async fn an_empty_files_panel_says_how_to_fill_it() {
+ let app = TestApp::build().await;
+ let cookie = app.sign_in("sub-empty", "empty@in.test", "Empty").await;
+ let page = app.get("/drive", Some(&cookie)).await;
+ assert_eq!(page.status, StatusCode::OK, "{}", page.text());
+ assert!(
+ page.text().contains("Nothing here yet"),
+ "no empty-state hint: {}",
+ page.text()
+ );
+ // And the drop handler the hint promises is on the page.
+ assert!(page.text().contains("__inDrop"), "{}", page.text());
+}