mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-28 12:08:10 -06:00
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
c1e3f20f5b
commit
222925c7d5
@@ -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) => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user