From 222925c7d591459dd2c6958ed4fa240c441b3ca0 Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Mon, 19 Oct 2026 09:41:50 -0400 Subject: [PATCH] LR-IMP-DRAGDROP: a web drop whose files could not be read says so Review follow-up: after counting what the import did, a drop where every file failed showed no notice at all. It now says how many photos were not readable (existing translated key). Co-Authored-By: Claude Opus 5.5 --- apps/lightcraft-web/src/web.rs | 8 +++++--- crates/ui-egui/src/i18n.rs | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/lightcraft-web/src/web.rs b/apps/lightcraft-web/src/web.rs index 1a490061f..1e258a524 100644 --- a/apps/lightcraft-web/src/web.rs +++ b/apps/lightcraft-web/src/web.rs @@ -528,15 +528,17 @@ impl WebApp { if !paths.is_empty() { match self.app.run("library.import", json!({"paths": paths})) { // what the import did, not what was submitted: duplicates and unsupported files add nothing, - // and a drop that only finds duplicates says nothing (as the desktop import's toast does - // when it shows where they are) + // a drop that only finds duplicates says nothing (as the desktop import's toast does when it + // shows where they are), and one whose files could not be read says so Ok(report) => { let count = |k: &str| report[k].as_array().map_or(0, Vec::len); - let (added, restored) = (count("imported"), count("restored")); + let (added, restored, failed) = (count("imported"), count("restored"), count("failed")); if added > 0 { self.app.toast(ctx, lightcraft_ui_egui::i18n::dropped_photos_added(added)); } else if restored > 0 { self.app.toast(ctx, lightcraft_ui_egui::i18n::dropped_photos_restored(restored)); + } else if failed > 0 { + self.app.toast(ctx, lightcraft_ui_egui::i18n::dropped_photos_unreadable(failed)); } } Err(e) => { diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 7fdda75f8..c92e8da27 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -283,6 +283,11 @@ pub fn dropped_photos_restored(n: usize) -> String { tr_format!("Restored {} photo{} from Recently Deleted", n, if n == 1 { "" } else { "s" }) } +/// The web build's notice for `n` dropped photos that could not be read (nothing else came of the drop). +pub fn dropped_photos_unreadable(n: usize) -> String { + tr_format!("{} photo{} not readable", n, if n == 1 { "" } else { "s" }) +} + /// The title and text of the message box shown when the desktop app's window can't start /// (issue #260), in the UI language: the error and, when there is one, the log file to look in. pub fn startup_failed_message(error: &str, log_file: Option<&str>) -> (String, String) {