forge
Explore
Log in

Don't you dare go Hollow

One explorer-style list, search left, no em-dash copy

Browse files at this commit

1eb1a69f23bee711346cf35dd004f7d730ea4d85Ahmet Kaan GümüşParent: 2b5e0c8
  • feat
    • one explorer-style list, search left, no em-dash copy
Show full message
feat(ui): one explorer-style list, search left, no em-dash copy

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.rsmodified+62 -81
@@ -8,7 +8,7 @@
88 //! itself is refused. Anything naming another owner's tree answers 404,
99 //! never 403.
1010 //!
11-//! `GET /drive?q=<text>` keeps the same page and swaps the folder panels
11+//! `GET /drive?q=<text>` keeps the same page and swaps the folder list
1212 //! for library-wide name hits — the filterbar's search box, submitted as a
1313 //! plain GET form. The old `GET /search?q=` address 303s here, so old links
1414 //! keep working.
@@ -250,7 +250,6 @@ async fn drive(cx: &Cx) -> Result {
250250 </nav>
251251 }
252252 }
253- <div class="spacer"></div>
254253 <form class="field-box-search" method="get" action="/drive">
255254 <input
256255 class="field-input"
@@ -284,44 +283,38 @@ async fn drive(cx: &Cx) -> Result {
284283 </div>
285284 </section>
286285 }
286+ // The upload control sits outside the list so the + menu's
287+ // "Upload files" label and the page-wide drop handler find it on
288+ // every drive view, folder or search. The input stays hidden via
289+ // the file-upload-input rule.
290+ <form id="upload-form" class="file-upload" method="post" action="/files"
291+ enctype="multipart/form-data" data-hard="" data-failed-label=(t(language, Key::UploadFailed))>
292+ <input type="hidden" name="folder_id" value=(current_id.clone())>
293+ <input id="drive-upload-input" class="file-upload-input" type="file" name="file" multiple="">
294+ </form>
287295 if let Some(hits) = hits {
288296 if hits.folders.is_empty() && hits.files.is_empty() {
289297 <p class="detail-quiet">(t(language, Key::NoResults))</p>
290- }
291- if !hits.folders.is_empty() {
292- <section class="panel">
293- <div class="panel-head">
294- <h2 class="panel-title">(t(language, Key::FoldersHeading))</h2>
295- <span class="chip">(format!("{}", hits.folders.len()))</span>
296- </div>
297- <div class="panel-body">
298- for folder in &hits.folders {
299- <p><a href=(format!("/drive?folder={}", folder.id))>(folder.name.clone())</a></p>
300- }
301- </div>
302- </section>
303- }
304- if !hits.files.is_empty() {
305- <section class="panel">
306- <div class="panel-head">
307- <h2 class="panel-title">(t(language, Key::FilesHeading))</h2>
308- <span class="chip">(format!("{}", hits.files.len()))</span>
309- </div>
310- <div class="panel-body">
311- for file in &hits.files {
312- <p><a href=(format!("/file/{}", file.id))>(file.name.clone())</a></p>
313- }
314- </div>
315- </section>
298+ } else {
299+ <section class="panel">
300+ <div class="panel-body">
301+ for folder in &hits.folders {
302+ <div class="dep-row">
303+ <a class="dep-link" href=(format!("/drive?folder={}", folder.id))>(folder.name.clone())</a>
304+ </div>
305+ }
306+ for file in &hits.files {
307+ <div class="dep-row">
308+ <a class="dep-link" href=(format!("/file/{}", file.id))>(file.name.clone())</a>
309+ </div>
310+ }
311+ </div>
312+ </section>
316313 }
317314 } else {
318315 <section class="panel">
319- <div class="panel-head">
320- <h2 class="panel-title">(t(language, Key::FoldersHeading))</h2>
321- <span class="chip">(format!("{}", listing.folders.len()))</span>
322- </div>
323316 <div class="panel-body">
324- if listing.folders.is_empty() {
317+ if listing.folders.is_empty() && listing.files.is_empty() {
325318 <p class="detail-quiet">(t(language, Key::EmptyFolder))</p>
326319 }
327320 for folder in listing.folders.iter() {
@@ -359,59 +352,47 @@ async fn drive(cx: &Cx) -> Result {
359352 }
360353 </div>
361354 }
362- </div>
363- </section>
364- <section class="panel">
365- <div class="panel-head">
366- <h2 class="panel-title">(t(language, Key::FilesHeading))</h2>
367- <span class="chip">(format!("{}", listing.files.len()))</span>
368- </div>
369- <div class="panel-body">
370- <form id="upload-form" class="file-upload" method="post" action="/files"
371- enctype="multipart/form-data" data-hard="" data-failed-label=(t(language, Key::UploadFailed))>
372- <input type="hidden" name="folder_id" value=(current_id.clone())>
373- // No visible chooser here: the + menu's "Upload files"
374- // label targets this input. It stays in the DOM, display-
375- // none via the file-upload-input rule.
376- <input id="drive-upload-input" class="file-upload-input" type="file" name="file" multiple="">
377- </form>
378- if listing.files.is_empty() {
379- <p class="detail-quiet">(t(language, Key::EmptyFiles))</p>
380- }
381- <div class="file-list">
382- for file in listing.files.iter() {
383- <div class="dep-row">
384- if file.thumb_state == ThumbState::Ready {
385- <img class="file-chip" src=(format!("/thumb/{}", file.id)) alt="">
386- } else {
387- <span class="file-chip" aria-hidden="true">"▦"</span>
388- }
389- <a class="dep-link" href=(format!("/file/{}", file.id))>(file.name.clone())</a>
390- <span class="file-chip-size">(human_size(file.size_bytes))</span>
391- <div class="spacer"></div>
355+ for file in listing.files.iter() {
356+ <div class="dep-row">
357+ if file.thumb_state == ThumbState::Ready {
358+ <img class="file-chip" src=(format!("/thumb/{}", file.id)) alt="">
359+ } else {
360+ <span class="file-chip" aria-hidden="true">"▦"</span>
361+ }
362+ if edit_id.as_deref() == Some(file.id.as_str()) {
392363 <form class="pop-row-form" method="post" action="/api/file/rename">
393364 <input type="hidden" name="id" value=(file.id.clone())>
394365 <input class="field-input" type="text" name="name" maxlength="255"
395- value=(file.name.clone()) required="" aria-label=(t(language, Key::RenameFile))>
366+ value=(file.name.clone()) required="" data-edit-focus=""
367+ aria-label=(t(language, Key::RenameFile))>
396368 <button class="quiet" type="submit">(t(language, Key::Rename))</button>
369+ <a class="quiet" href=(here.clone())>(t(language, Key::Cancel))</a>
397370 </form>
398- <form class="pop-row-form" method="post" action="/api/file/move">
399- <input type="hidden" name="id" value=(file.id.clone())>
400- <select class="field-input" name="folder_id" aria-label=(t(language, Key::MoveFile))>
401- <option value="">(t(language, Key::Drive))</option>
402- for dest in destinations.iter() {
403- <option value=(dest.0.clone())>(dest.1.clone())</option>
404- }
405- </select>
406- <button class="quiet" type="submit">(t(language, Key::Move))</button>
407- </form>
408- <form class="detail-delete-form" method="post" action="/api/file/delete">
409- <input type="hidden" name="id" value=(file.id.clone())>
410- <button class="quiet" type="submit">(t(language, Key::Delete))</button>
411- </form>
412- </div>
413- }
414- </div>
371+ } else {
372+ <a class="dep-link" href=(format!("/file/{}", file.id))>(file.name.clone())</a>
373+ }
374+ <span class="file-chip-size">(human_size(file.size_bytes))</span>
375+ <div class="spacer"></div>
376+ if edit_id.as_deref() != Some(file.id.as_str()) {
377+ <a class="quiet" href=(format!("{here}{edit_sep}edit={}", file.id))
378+ aria-label=(t(language, Key::RenameFile))>(t(language, Key::Rename))</a>
379+ <form class="pop-row-form" method="post" action="/api/file/move">
380+ <input type="hidden" name="id" value=(file.id.clone())>
381+ <select class="field-input" name="folder_id" aria-label=(t(language, Key::MoveFile))>
382+ <option value="">(t(language, Key::Drive))</option>
383+ for dest in destinations.iter() {
384+ <option value=(dest.0.clone())>(dest.1.clone())</option>
385+ }
386+ </select>
387+ <button class="quiet" type="submit">(t(language, Key::Move))</button>
388+ </form>
389+ <form class="detail-delete-form" method="post" action="/api/file/delete">
390+ <input type="hidden" name="id" value=(file.id.clone())>
391+ <button class="quiet" type="submit">(t(language, Key::Delete))</button>
392+ </form>
393+ }
394+ </div>
395+ }
415396 </div>
416397 </section>
417398 }
crates/in-web/src/i18n.rsmodified+8 -11
@@ -105,7 +105,6 @@ pub enum Key {
105105 MoveFolder,
106106 DeleteFolder,
107107 EmptyFolder,
108- EmptyFiles,
109108 FoldersHeading,
110109 FilesHeading,
111110 NameColumn,
@@ -199,7 +198,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
199198 SomethingWentWrong => "Something went wrong.",
200199 NothingAtThisAddress => "There is nothing at this address.",
201200 BackToDrive => "Back to the drive",
202- WelcomeTitle => "In — your files",
201+ WelcomeTitle => "In: your files",
203202 WelcomeBlurb => "Your folders and files, shared on your terms.",
204203 SignIn => "Sign in",
205204 NavDrive => "Drive",
@@ -217,8 +216,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
217216 RenameFolder => "Rename folder",
218217 MoveFolder => "Move folder",
219218 DeleteFolder => "Delete folder",
220- EmptyFolder => "This folder is empty.",
221- EmptyFiles => "Nothing here yet — press + to upload, or drop files on this page.",
219+ EmptyFolder => "This folder is empty. Press + to create or upload, or drop files on this page.",
222220 FoldersHeading => "Folders",
223221 FilesHeading => "Files",
224222 NameColumn => "Name",
@@ -273,10 +271,10 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
273271 EnableUser => "Enable",
274272 DisabledBadge => "disabled",
275273 LinkCreated => "Link created.",
276- CopyLinkOnce => "Copy it now — it is shown once and never again.",
274+ CopyLinkOnce => "Copy it now. It is shown once and never again.",
277275 ExpiresLabel => "Expires",
278276 NeverExpires => "Never",
279- ViewOnly => "View only — preview, no downloads",
277+ ViewOnly => "View only: preview, no downloads",
280278 NoLinks => "No share links yet.",
281279 ManageLinks => "Share links",
282280 UiLabel => "Interface",
@@ -301,7 +299,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
301299 SomethingWentWrong => "Bir şeyler ters gitti.",
302300 NothingAtThisAddress => "Bu adreste bir şey yok.",
303301 BackToDrive => "Sürücüye dön",
304- WelcomeTitle => "In — dosyaların",
302+ WelcomeTitle => "In: dosyaların",
305303 WelcomeBlurb => "Klasörlerin ve dosyaların, senin kurallarınla.",
306304 SignIn => "Oturum aç",
307305 NavDrive => "Sürücü",
@@ -319,8 +317,7 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
319317 RenameFolder => "Klasörü yeniden adlandır",
320318 MoveFolder => "Klasörü taşı",
321319 DeleteFolder => "Klasörü sil",
322- EmptyFolder => "Bu klasör boş.",
323- EmptyFiles => "Henüz bir şey yok — + ile yükle ya da dosyaları bu sayfaya bırak.",
320+ EmptyFolder => "Bu klasör boş. + ile oluştur ya da yükle, ya da dosyaları bu sayfaya bırak.",
324321 FoldersHeading => "Klasörler",
325322 FilesHeading => "Dosyalar",
326323 NameColumn => "Ad",
@@ -375,10 +372,10 @@ pub fn t(lang: Lang, key: Key) -> &'static str {
375372 EnableUser => "Etkinleştir",
376373 DisabledBadge => "devre dışı",
377374 LinkCreated => "Bağlantı oluşturuldu.",
378- CopyLinkOnce => "Şimdi kopyala — bir kez gösterilir, bir daha gösterilmez.",
375+ CopyLinkOnce => "Şimdi kopyala. Bir kez gösterilir, bir daha gösterilmez.",
379376 ExpiresLabel => "Bitiş",
380377 NeverExpires => "Süresiz",
381- ViewOnly => "Yalnızca görüntüleme — önizleme, indirme yok",
378+ ViewOnly => "Yalnızca görüntüleme: önizleme, indirme yok",
382379 NoLinks => "Henüz paylaşım bağlantısı yok.",
383380 ManageLinks => "Paylaşım bağlantıları",
384381 UiLabel => "Arayüz",
crates/in-web/src/server.rsmodified+4 -4
@@ -234,8 +234,8 @@ impl Refusal {
234234 // the target exists.
235235 Refusal::CrossOwner => "No such file or folder.".to_string(),
236236 Refusal::ShareRevoked => "This link no longer works.".to_string(),
237- Refusal::UploadExpired => "This upload expired — start it again.".to_string(),
238- Refusal::BadChunk => "That piece arrived damaged — send it again.".to_string(),
237+ Refusal::UploadExpired => "This upload expired. Start it again.".to_string(),
238+ Refusal::BadChunk => "That piece arrived damaged. Send it again.".to_string(),
239239 Refusal::AncestorTrashed => "Restore the folder it is in first.".to_string(),
240240 Refusal::Unavailable => "Something went wrong.".to_string(),
241241 Refusal::BadUi => "That interface choice is not offered.".to_string(),
@@ -259,8 +259,8 @@ impl Refusal {
259259 Refusal::FolderNotEmpty => "Bu klasörde hâlâ dosyalar var.".to_string(),
260260 Refusal::CrossOwner => "Böyle bir dosya ya da klasör yok.".to_string(),
261261 Refusal::ShareRevoked => "Bu bağlantı artık çalışmıyor.".to_string(),
262- Refusal::UploadExpired => "Bu yüklemenin süresi doldu — yeniden başlat.".to_string(),
263- Refusal::BadChunk => "Bu parça bozuk geldi — yeniden gönder.".to_string(),
262+ Refusal::UploadExpired => "Bu yüklemenin süresi doldu. Yeniden başlat.".to_string(),
263+ Refusal::BadChunk => "Bu parça bozuk geldi. Yeniden gönder.".to_string(),
264264 Refusal::Unavailable => "Bir şeyler ters gitti.".to_string(),
265265 Refusal::AncestorTrashed => "Önce içinde olduğu klasörü geri yükle.".to_string(),
266266 Refusal::BadUi => "Bu arayüz seçeneği sunulmuyor.".to_string(),
crates/in-web/tests/http.rsmodified+71 -14
@@ -1539,7 +1539,7 @@ async fn search_scopes_to_owner_and_hides_trashed() {
15391539 }
15401540
15411541 #[tokio::test]
1542-async fn drive_search_results_replace_the_folder_panels() {
1542+async fn drive_search_results_merge_into_one_panel() {
15431543 let app = TestApp::build().await;
15441544 let cookie = app.sign_in("sub-search-in-place", "inplace@in.test", "InPlace").await;
15451545 let owner = owner_of(&app, "sub-search-in-place").await;
@@ -1557,21 +1557,30 @@ async fn drive_search_results_replace_the_folder_panels() {
15571557 let page = app.get("/drive?q=holiday", Some(&cookie)).await;
15581558 assert_eq!(page.status, StatusCode::OK, "{}", page.text());
15591559 let body = page.text();
1560- // Both hits render in place on the drive, wired to their surfaces.
1560+ // Both hits render in one shared list, folders first, wired to their surfaces.
15611561 assert!(body.contains("holiday photos"), "{body}");
15621562 assert!(body.contains("holiday report.txt"), "{body}");
15631563 assert!(body.contains(&format!("/drive?folder={folder}")), "{body}");
15641564 assert!(body.contains(&format!("/file/{file}")), "{body}");
1565- // One chip per list, like the folder panels they replace.
1566- assert_eq!(body.matches("<span class=\"chip\">1</span>").count(), 2, "{body}");
1565+ let folder_at = body.find("holiday photos").expect("no folder hit");
1566+ let file_at = body.find("holiday report.txt").expect("no file hit");
1567+ assert!(folder_at < file_at, "file hit precedes folder hit: {body}");
1568+ // One panel, no heads or chips.
1569+ assert_eq!(body.matches("<section class=\"panel\">").count(), 1, "{body}");
1570+ assert!(!body.contains("panel-head"), "{body}");
1571+ assert!(!body.contains("class=\"chip\""), "{body}");
1572+ assert!(!body.contains(">Folders</h2>"), "{body}");
1573+ assert!(!body.contains(">Files</h2>"), "{body}");
15671574 // The caption names the query and the box keeps it.
15681575 assert!(body.contains("Search results"), "{body}");
15691576 assert!(body.contains("holiday"), "{body}");
15701577 assert!(body.contains("value=\"holiday\""), "{body}");
15711578 assert!(body.contains("name=\"q\""), "{body}");
1572- // The folder view is gone: no crumbs, no upload, no row mutations.
1579+ // The upload control stays in the DOM for the + menu and the drop handler.
1580+ assert!(body.contains("id=\"upload-form\""), "{body}");
1581+ assert!(body.contains("id=\"drive-upload-input\""), "{body}");
1582+ // The folder view is gone: no crumbs, no row mutations.
15731583 assert!(!body.contains("detail-crumbs"), "{body}");
1574- assert!(!body.contains("id=\"upload-form\""), "{body}");
15751584 assert!(!body.contains("action=\"/api/folder/rename\""), "{body}");
15761585 }
15771586
@@ -2380,7 +2389,7 @@ async fn trash_panels_nest_inside_the_stage() {
23802389 }
23812390
23822391 #[tokio::test]
2383-async fn drive_search_panels_nest_inside_the_stage() {
2392+async fn drive_search_panel_nests_inside_the_stage() {
23842393 let app = TestApp::build().await;
23852394 let admin = app.sign_in("sub-stage-search", "stagesearch@in.test", "StageSearch").await;
23862395 let owner = owner_of(&app, "sub-stage-search").await;
@@ -2389,7 +2398,7 @@ async fn drive_search_panels_nest_inside_the_stage() {
23892398 assert_eq!(page.status, StatusCode::OK, "{}", page.text());
23902399 assert_stage_nests(
23912400 &page.text(),
2392- &["panel-head", "name=\"q\"", "staged-report.txt"],
2401+ &["panel-body", "name=\"q\"", "staged-report.txt"],
23932402 );
23942403 }
23952404
@@ -2705,16 +2714,64 @@ async fn drive_edit_row_renders_the_rename_form() {
27052714 }
27062715
27072716 #[tokio::test]
2708-async fn an_empty_files_panel_says_how_to_fill_it() {
2717+async fn drive_lists_folders_before_files_in_one_panel() {
2718+ let app = TestApp::build().await;
2719+ let cookie = app.sign_in("sub-merged", "merged@in.test", "Merged").await;
2720+ let owner = owner_of(&app, "sub-merged").await;
2721+ // The file's name sorts first alphabetically, so order proves folders lead.
2722+ let file_id = file_id(&app, &owner, "aaa file.txt", b"a").await;
2723+ let answer = app
2724+ .post("/api/folder/create", Some(&cookie), &[("parent_id", ""), ("name", "mmm folder")])
2725+ .await;
2726+ assert!(answer.accepted(), "setup create refused: {:?}", answer.location);
2727+
2728+ let page = app.get("/drive", Some(&cookie)).await;
2729+ assert_eq!(page.status, StatusCode::OK, "{}", page.text());
2730+ let body = page.text();
2731+ // One panel, no heads or chips — just the merged list.
2732+ assert_eq!(body.matches("<section class=\"panel\">").count(), 1, "{body}");
2733+ assert!(!body.contains("panel-head"), "{body}");
2734+ assert!(!body.contains("class=\"chip\""), "{body}");
2735+ assert!(!body.contains(">Folders</h2>"), "{body}");
2736+ assert!(!body.contains(">Files</h2>"), "{body}");
2737+ // Folders first, then files, each wired to its surface.
2738+ let folder_at = body.find("mmm folder").expect("no folder row");
2739+ let file_at = body.find("aaa file.txt").expect("no file row");
2740+ assert!(folder_at < file_at, "file row precedes folder row: {body}");
2741+ assert!(body.contains("action=\"/api/folder/move\""), "{body}");
2742+ // File rename follows the folder pattern: an edit link on the plain
2743+ // view, the form only on the edit view.
2744+ assert!(
2745+ body.contains(&format!("/drive?edit={file_id}")),
2746+ "file row has no edit entry: {body}"
2747+ );
2748+ let edit_page = app
2749+ .get(&format!("/drive?edit={file_id}"), Some(&cookie))
2750+ .await;
2751+ assert!(
2752+ edit_page.text().contains("action=\"/api/file/rename\""),
2753+ "{}",
2754+ edit_page.text()
2755+ );
2756+ // A non-empty list carries no empty state.
2757+ assert!(!body.contains("This folder is empty"), "{body}");
2758+}
2759+
2760+#[tokio::test]
2761+async fn an_empty_folder_says_how_to_fill_it() {
27092762 let app = TestApp::build().await;
27102763 let cookie = app.sign_in("sub-empty", "empty@in.test", "Empty").await;
27112764 let page = app.get("/drive", Some(&cookie)).await;
27122765 assert_eq!(page.status, StatusCode::OK, "{}", page.text());
2766+ let body = page.text();
2767+ // The single empty state names both ways to fill the folder.
27132768 assert!(
2714- page.text().contains("Nothing here yet"),
2715- "no empty-state hint: {}",
2716- page.text()
2769+ body.contains("This folder is empty. Press + to create or upload, or drop files on this page."),
2770+ "no empty-state hint: {body}"
27172771 );
2718- // And the drop handler the hint promises is on the page.
2719- assert!(page.text().contains("__inDrop"), "{}", page.text());
2772+ assert_eq!(body.matches("<section class=\"panel\">").count(), 1, "{body}");
2773+ assert!(!body.contains("panel-head"), "{body}");
2774+ // And the upload control plus the drop handler the hint promises are on the page.
2775+ assert!(body.contains("id=\"upload-form\""), "{body}");
2776+ assert!(body.contains("__inDrop"), "{body}");
27202777 }
style/main.scssmodified+3 -1
@@ -1790,7 +1790,9 @@ img.avatar {
17901790 overflow-y: auto;
17911791 }
17921792
1793-.pop-row-form { display: block; }
1793+// In's rows pair a dropdown with its submit (move), so the form is a row of
1794+// controls, not a block — iz's pop-rows only ever hold one.
1795+.pop-row-form { display: flex; align-items: center; gap: 8px; }
17941796
17951797 .pop-row {
17961798 display: flex;