From 1eb1a69f23bee711346cf35dd004f7d730ea4d85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 5 Sep 2026 08:07:40 +0300 Subject: [PATCH] feat(ui): one explorer-style list, search left, no em-dash copy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Folders and Files stop being separate panels: the drive is one list, folders first then files, like a file manager — one compact panel, no heads or chips, one empty state ("This folder is empty. Press + to create or upload, or drop files on this page."). Search results merge the same way. File rows follow the folder edit-mode pattern (Rename link swaps the row into its pre-filled rename form via ?edit=) instead of a permanent inline input, and row actions pack onto one line. The search box moves to the left of the bar, next to +. User-visible copy no longer uses em dashes anywhere: welcome title, empty states, link-once notice, view-only label, upload refusals. --- crates/in-web/src/drive.rs | 143 ++++++++++++++++-------------------- crates/in-web/src/i18n.rs | 19 ++--- crates/in-web/src/server.rs | 8 +- crates/in-web/tests/http.rs | 85 +++++++++++++++++---- style/main.scss | 4 +- 5 files changed, 148 insertions(+), 111 deletions(-) diff --git a/crates/in-web/src/drive.rs b/crates/in-web/src/drive.rs index 7d43456..eb00054 100644 --- a/crates/in-web/src/drive.rs +++ b/crates/in-web/src/drive.rs @@ -8,7 +8,7 @@ //! itself is refused. Anything naming another owner's tree answers 404, //! never 403. //! -//! `GET /drive?q=` keeps the same page and swaps the folder panels +//! `GET /drive?q=` keeps the same page and swaps the folder list //! for library-wide name hits — the filterbar's search box, submitted as a //! plain GET form. The old `GET /search?q=` address 303s here, so old links //! keep working. @@ -250,7 +250,6 @@ async fn drive(cx: &Cx) -> Result { } } -
if let Some(hits) = hits { if hits.folders.is_empty() && hits.files.is_empty() {

(t(language, Key::NoResults))

- } - if !hits.folders.is_empty() { -
-
-

(t(language, Key::FoldersHeading))

- (format!("{}", hits.folders.len())) -
-
- for folder in &hits.folders { -

(folder.name.clone())

- } -
-
- } - if !hits.files.is_empty() { -
-
-

(t(language, Key::FilesHeading))

- (format!("{}", hits.files.len())) -
-
- for file in &hits.files { -

(file.name.clone())

- } -
-
+ } else { +
+
+ for folder in &hits.folders { + + } + for file in &hits.files { + + } +
+
} } else {
-
-

(t(language, Key::FoldersHeading))

- (format!("{}", listing.folders.len())) -
- if listing.folders.is_empty() { + if listing.folders.is_empty() && listing.files.is_empty() {

(t(language, Key::EmptyFolder))

} for folder in listing.folders.iter() { @@ -359,59 +352,47 @@ async fn drive(cx: &Cx) -> Result { }
} - -
-
-
-

(t(language, Key::FilesHeading))

- (format!("{}", listing.files.len())) -
-
-
- - // No visible chooser here: the + menu's "Upload files" - // label targets this input. It stays in the DOM, display- - // none via the file-upload-input rule. - -
- if listing.files.is_empty() { -

(t(language, Key::EmptyFiles))

- } -
- for file in listing.files.iter() { -
- if file.thumb_state == ThumbState::Ready { - - } else { - - } - (file.name.clone()) - (human_size(file.size_bytes)) -
+ for file in listing.files.iter() { +
+ if file.thumb_state == ThumbState::Ready { + + } else { + + } + if edit_id.as_deref() == Some(file.id.as_str()) {
+ value=(file.name.clone()) required="" data-edit-focus="" + aria-label=(t(language, Key::RenameFile))> + (t(language, Key::Cancel))
-
- - - -
-
- - -
-
- } -
+ } else { + (file.name.clone()) + } + (human_size(file.size_bytes)) +
+ if edit_id.as_deref() != Some(file.id.as_str()) { + (t(language, Key::Rename)) +
+ + + +
+
+ + +
+ } +
+ }
} diff --git a/crates/in-web/src/i18n.rs b/crates/in-web/src/i18n.rs index 0bf704f..419c770 100644 --- a/crates/in-web/src/i18n.rs +++ b/crates/in-web/src/i18n.rs @@ -105,7 +105,6 @@ pub enum Key { MoveFolder, DeleteFolder, EmptyFolder, - EmptyFiles, FoldersHeading, FilesHeading, NameColumn, @@ -199,7 +198,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str { SomethingWentWrong => "Something went wrong.", NothingAtThisAddress => "There is nothing at this address.", BackToDrive => "Back to the drive", - WelcomeTitle => "In — your files", + WelcomeTitle => "In: your files", WelcomeBlurb => "Your folders and files, shared on your terms.", SignIn => "Sign in", NavDrive => "Drive", @@ -217,8 +216,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str { RenameFolder => "Rename folder", MoveFolder => "Move folder", DeleteFolder => "Delete folder", - EmptyFolder => "This folder is empty.", - EmptyFiles => "Nothing here yet — press + to upload, or drop files on this page.", + EmptyFolder => "This folder is empty. Press + to create or upload, or drop files on this page.", FoldersHeading => "Folders", FilesHeading => "Files", NameColumn => "Name", @@ -273,10 +271,10 @@ pub fn t(lang: Lang, key: Key) -> &'static str { EnableUser => "Enable", DisabledBadge => "disabled", LinkCreated => "Link created.", - CopyLinkOnce => "Copy it now — it is shown once and never again.", + CopyLinkOnce => "Copy it now. It is shown once and never again.", ExpiresLabel => "Expires", NeverExpires => "Never", - ViewOnly => "View only — preview, no downloads", + ViewOnly => "View only: preview, no downloads", NoLinks => "No share links yet.", ManageLinks => "Share links", UiLabel => "Interface", @@ -301,7 +299,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str { SomethingWentWrong => "Bir şeyler ters gitti.", NothingAtThisAddress => "Bu adreste bir şey yok.", BackToDrive => "Sürücüye dön", - WelcomeTitle => "In — dosyaların", + WelcomeTitle => "In: dosyaların", WelcomeBlurb => "Klasörlerin ve dosyaların, senin kurallarınla.", SignIn => "Oturum aç", NavDrive => "Sürücü", @@ -319,8 +317,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str { RenameFolder => "Klasörü yeniden adlandır", 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.", + EmptyFolder => "Bu klasör boş. + ile oluştur ya da yükle, ya da dosyaları bu sayfaya bırak.", FoldersHeading => "Klasörler", FilesHeading => "Dosyalar", NameColumn => "Ad", @@ -375,10 +372,10 @@ pub fn t(lang: Lang, key: Key) -> &'static str { EnableUser => "Etkinleştir", DisabledBadge => "devre dışı", LinkCreated => "Bağlantı oluşturuldu.", - CopyLinkOnce => "Şimdi kopyala — bir kez gösterilir, bir daha gösterilmez.", + CopyLinkOnce => "Şimdi kopyala. Bir kez gösterilir, bir daha gösterilmez.", ExpiresLabel => "Bitiş", NeverExpires => "Süresiz", - ViewOnly => "Yalnızca görüntüleme — önizleme, indirme yok", + ViewOnly => "Yalnızca görüntüleme: önizleme, indirme yok", NoLinks => "Henüz paylaşım bağlantısı yok.", ManageLinks => "Paylaşım bağlantıları", UiLabel => "Arayüz", diff --git a/crates/in-web/src/server.rs b/crates/in-web/src/server.rs index a6ff06a..23e7de9 100644 --- a/crates/in-web/src/server.rs +++ b/crates/in-web/src/server.rs @@ -234,8 +234,8 @@ impl Refusal { // the target exists. Refusal::CrossOwner => "No such file or folder.".to_string(), Refusal::ShareRevoked => "This link no longer works.".to_string(), - Refusal::UploadExpired => "This upload expired — start it again.".to_string(), - Refusal::BadChunk => "That piece arrived damaged — send it again.".to_string(), + Refusal::UploadExpired => "This upload expired. Start it again.".to_string(), + Refusal::BadChunk => "That piece arrived damaged. Send it again.".to_string(), Refusal::AncestorTrashed => "Restore the folder it is in first.".to_string(), Refusal::Unavailable => "Something went wrong.".to_string(), Refusal::BadUi => "That interface choice is not offered.".to_string(), @@ -259,8 +259,8 @@ impl Refusal { Refusal::FolderNotEmpty => "Bu klasörde hâlâ dosyalar var.".to_string(), Refusal::CrossOwner => "Böyle bir dosya ya da klasör yok.".to_string(), Refusal::ShareRevoked => "Bu bağlantı artık çalışmıyor.".to_string(), - Refusal::UploadExpired => "Bu yüklemenin süresi doldu — yeniden başlat.".to_string(), - Refusal::BadChunk => "Bu parça bozuk geldi — yeniden gönder.".to_string(), + Refusal::UploadExpired => "Bu yüklemenin süresi doldu. Yeniden başlat.".to_string(), + Refusal::BadChunk => "Bu parça bozuk geldi. Yeniden gönder.".to_string(), Refusal::Unavailable => "Bir şeyler ters gitti.".to_string(), Refusal::AncestorTrashed => "Önce içinde olduğu klasörü geri yükle.".to_string(), Refusal::BadUi => "Bu arayüz seçeneği sunulmuyor.".to_string(), diff --git a/crates/in-web/tests/http.rs b/crates/in-web/tests/http.rs index bdf4173..c118493 100644 --- a/crates/in-web/tests/http.rs +++ b/crates/in-web/tests/http.rs @@ -1539,7 +1539,7 @@ async fn search_scopes_to_owner_and_hides_trashed() { } #[tokio::test] -async fn drive_search_results_replace_the_folder_panels() { +async fn drive_search_results_merge_into_one_panel() { let app = TestApp::build().await; let cookie = app.sign_in("sub-search-in-place", "inplace@in.test", "InPlace").await; let owner = owner_of(&app, "sub-search-in-place").await; @@ -1557,21 +1557,30 @@ async fn drive_search_results_replace_the_folder_panels() { let page = app.get("/drive?q=holiday", Some(&cookie)).await; assert_eq!(page.status, StatusCode::OK, "{}", page.text()); let body = page.text(); - // Both hits render in place on the drive, wired to their surfaces. + // Both hits render in one shared list, folders first, wired to their surfaces. assert!(body.contains("holiday photos"), "{body}"); assert!(body.contains("holiday report.txt"), "{body}"); assert!(body.contains(&format!("/drive?folder={folder}")), "{body}"); assert!(body.contains(&format!("/file/{file}")), "{body}"); - // One chip per list, like the folder panels they replace. - assert_eq!(body.matches("1").count(), 2, "{body}"); + let folder_at = body.find("holiday photos").expect("no folder hit"); + let file_at = body.find("holiday report.txt").expect("no file hit"); + assert!(folder_at < file_at, "file hit precedes folder hit: {body}"); + // One panel, no heads or chips. + assert_eq!(body.matches("
").count(), 1, "{body}"); + assert!(!body.contains("panel-head"), "{body}"); + assert!(!body.contains("class=\"chip\""), "{body}"); + assert!(!body.contains(">Folders"), "{body}"); + assert!(!body.contains(">Files"), "{body}"); // The caption names the query and the box keeps it. assert!(body.contains("Search results"), "{body}"); assert!(body.contains("holiday"), "{body}"); assert!(body.contains("value=\"holiday\""), "{body}"); assert!(body.contains("name=\"q\""), "{body}"); - // The folder view is gone: no crumbs, no upload, no row mutations. + // The upload control stays in the DOM for the + menu and the drop handler. + assert!(body.contains("id=\"upload-form\""), "{body}"); + assert!(body.contains("id=\"drive-upload-input\""), "{body}"); + // The folder view is gone: no crumbs, no row mutations. assert!(!body.contains("detail-crumbs"), "{body}"); - assert!(!body.contains("id=\"upload-form\""), "{body}"); assert!(!body.contains("action=\"/api/folder/rename\""), "{body}"); } @@ -2380,7 +2389,7 @@ async fn trash_panels_nest_inside_the_stage() { } #[tokio::test] -async fn drive_search_panels_nest_inside_the_stage() { +async fn drive_search_panel_nests_inside_the_stage() { let app = TestApp::build().await; let admin = app.sign_in("sub-stage-search", "stagesearch@in.test", "StageSearch").await; let owner = owner_of(&app, "sub-stage-search").await; @@ -2389,7 +2398,7 @@ async fn drive_search_panels_nest_inside_the_stage() { assert_eq!(page.status, StatusCode::OK, "{}", page.text()); assert_stage_nests( &page.text(), - &["panel-head", "name=\"q\"", "staged-report.txt"], + &["panel-body", "name=\"q\"", "staged-report.txt"], ); } @@ -2705,16 +2714,64 @@ async fn drive_edit_row_renders_the_rename_form() { } #[tokio::test] -async fn an_empty_files_panel_says_how_to_fill_it() { +async fn drive_lists_folders_before_files_in_one_panel() { + let app = TestApp::build().await; + let cookie = app.sign_in("sub-merged", "merged@in.test", "Merged").await; + let owner = owner_of(&app, "sub-merged").await; + // The file's name sorts first alphabetically, so order proves folders lead. + let file_id = file_id(&app, &owner, "aaa file.txt", b"a").await; + let answer = app + .post("/api/folder/create", Some(&cookie), &[("parent_id", ""), ("name", "mmm folder")]) + .await; + assert!(answer.accepted(), "setup create refused: {:?}", answer.location); + + let page = app.get("/drive", Some(&cookie)).await; + assert_eq!(page.status, StatusCode::OK, "{}", page.text()); + let body = page.text(); + // One panel, no heads or chips — just the merged list. + assert_eq!(body.matches("
").count(), 1, "{body}"); + assert!(!body.contains("panel-head"), "{body}"); + assert!(!body.contains("class=\"chip\""), "{body}"); + assert!(!body.contains(">Folders"), "{body}"); + assert!(!body.contains(">Files"), "{body}"); + // Folders first, then files, each wired to its surface. + let folder_at = body.find("mmm folder").expect("no folder row"); + let file_at = body.find("aaa file.txt").expect("no file row"); + assert!(folder_at < file_at, "file row precedes folder row: {body}"); + assert!(body.contains("action=\"/api/folder/move\""), "{body}"); + // File rename follows the folder pattern: an edit link on the plain + // view, the form only on the edit view. + assert!( + body.contains(&format!("/drive?edit={file_id}")), + "file row has no edit entry: {body}" + ); + let edit_page = app + .get(&format!("/drive?edit={file_id}"), Some(&cookie)) + .await; + assert!( + edit_page.text().contains("action=\"/api/file/rename\""), + "{}", + edit_page.text() + ); + // A non-empty list carries no empty state. + assert!(!body.contains("This folder is empty"), "{body}"); +} + +#[tokio::test] +async fn an_empty_folder_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()); + let body = page.text(); + // The single empty state names both ways to fill the folder. assert!( - page.text().contains("Nothing here yet"), - "no empty-state hint: {}", - page.text() + body.contains("This folder is empty. Press + to create or upload, or drop files on this page."), + "no empty-state hint: {body}" ); - // And the drop handler the hint promises is on the page. - assert!(page.text().contains("__inDrop"), "{}", page.text()); + assert_eq!(body.matches("
").count(), 1, "{body}"); + assert!(!body.contains("panel-head"), "{body}"); + // And the upload control plus the drop handler the hint promises are on the page. + assert!(body.contains("id=\"upload-form\""), "{body}"); + assert!(body.contains("__inDrop"), "{body}"); } diff --git a/style/main.scss b/style/main.scss index d069a3f..bb352c4 100644 --- a/style/main.scss +++ b/style/main.scss @@ -1790,7 +1790,9 @@ img.avatar { overflow-y: auto; } -.pop-row-form { display: block; } +// In's rows pair a dropdown with its submit (move), so the form is a row of +// controls, not a block — iz's pop-rows only ever hold one. +.pop-row-form { display: flex; align-items: center; gap: 8px; } .pop-row { display: flex;