# Conflicts:
#	crates/ui-egui/src/panels/grid.rs
#	crates/ui-egui/src/tests_panels.rs
#	docs/parity-checklist.md
This commit is contained in:
Claude 2026-10-11 11:49:25 +00:00
commit 9dc0d0b62b
No known key found for this signature in database
3 changed files with 51 additions and 1 deletions

View File

@ -946,6 +946,7 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
} else {
let add = ui.menu_button(crate::i18n::tr("Add to Album"), |ui| {
let albums: Vec<_> = app.session.catalog.albums().filter(|a| !a.folder && !a.is_smart()).map(|a| (a.id.0, a.name.clone())).collect();
let any = !albums.is_empty();
for (aid, name) in albums {
let b = ui.button(name);
register(ui.ctx(), format!("button:contextAlbum:{aid}"), b.rect);
@ -956,6 +957,16 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
}
}
}
if any {
ui.separator();
}
// as in the Photo menu: a new album holding the selection, also when there is none yet
// to pick (issue #676: the submenu came up empty)
let new = ui.button(crate::i18n::tr("New Album…"));
register(ui.ctx(), "button:contextNewAlbum", new.rect);
if new.clicked() {
let _ = app.run("dialog.newAlbum", json!({}));
}
});
register(ui.ctx(), "button:contextAddToAlbum", add.response.rect);
}

View File

@ -1183,6 +1183,7 @@ fn the_tracklog_toast_shows_after_a_while() {
let _ = std::fs::remove_dir_all(&dir);
}
<<<<<<< HEAD
/// Issue #678: Settings ▸ Faces cannot switch recognition on until a recognition model is chosen:
/// the box is off and clicking it changes nothing. Installing a model switches recognition on by
/// itself, and from then on the box turns it off and on.
@ -1254,15 +1255,35 @@ fn local_photos_cannot_be_added_to_albums_until_they_join_my_photos() {
let thumb = widget(&h, &format!("thumb:{}", local.0));
// right-click: Add to Album is there but off, so hovering opens no album entries
=======
/// Issue #676: right-click ▸ Add to Album offers New Album… like the Photo menu does, also when
/// the library has no album yet (the submenu used to come up empty); the new album holds the photo.
#[test]
fn right_click_add_to_album_offers_a_new_album_when_there_is_none() {
let mut h = demo([1400.0, 900.0], json!({"view": "photoGrid", "leftPanel": true}));
let plain: Vec<u64> = h.app.session.catalog.albums().filter(|a| !a.folder && !a.is_smart()).map(|a| a.id.0).collect();
for id in plain {
h.app.session.execute("album.delete", &json!({"id": id})).unwrap();
}
assert!(h.app.session.catalog.albums().all(|a| a.folder || a.is_smart()), "no plain album is left");
let photo = lightcraft_catalog::PhotoId(h.app.session.visible_cloned()[1].0);
h.step();
let thumb = widget(&h, &format!("thumb:{}", photo.0));
>>>>>>> pr/685
let r = h.request("ui.click", json!({"x": thumb.center().x, "y": thumb.center().y, "button": "right"}), T);
assert_eq!(r["ok"], true, "{r}");
h.step();
h.step();
<<<<<<< HEAD
assert!(h.app.session.selection.contains(local));
=======
assert!(h.app.session.selection.contains(photo), "right-click selects the photo");
>>>>>>> pr/685
let r = h.request("ui.hoverWidget", json!({"id": "button:contextAddToAlbum"}), T);
assert_eq!(r["ok"], true, "{r}");
h.step();
h.step();
<<<<<<< HEAD
assert!(!h.app.widgets.iter().any(|(w, _)| w.starts_with("button:contextAlbum:")), "the submenu must not open for a Local photo");
let r = h.request("ui.key", json!({"key": "Escape"}), T);
assert_eq!(r["ok"], true, "{r}");
@ -1323,4 +1344,22 @@ fn local_photos_cannot_be_added_to_albums_until_they_join_my_photos() {
h.step();
assert_eq!(h.app.session.catalog.album(album_id).unwrap().photos, vec![local]);
let _ = std::fs::remove_dir_all(&dir);
=======
let r = h.request("ui.clickWidget", json!({"id": "button:contextNewAlbum"}), T);
assert_eq!(r["ok"], true, "{r}");
h.step();
h.step();
match &mut h.app.ui.dialog {
Some(crate::state::Dialog::NewAlbum { name, folder: false, parent: None }) => *name = "Trip".into(),
other => panic!("New Album dialog expected, got {other:?}"),
}
h.step();
let r = h.request("ui.clickWidget", json!({"id": "button:dialogOk"}), T);
assert_eq!(r["ok"], true, "{r}");
h.step();
h.step();
let trip = h.app.session.catalog.albums().find(|a| a.name == "Trip").expect("the album was created");
assert!(trip.photos.contains(&photo), "the right-clicked photo is in it: {:?}", trip.photos);
assert!(h.app.ui.dialog.is_none(), "{:?}", h.app.ui.dialog);
>>>>>>> pr/685
}

View File

@ -93,7 +93,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts).
| LR-LIB-ALLPHOTOS | All photos | P0 | ✅ | `cmd:library.source`, `crates/ui-egui/src/panels/left.rs` | |
| LR-LIB-RECENT-ADDED | Recently added | P1 | ✅ | `cmd:library.source` (`recentlyAdded`), `crates/engine/src/view.rs` (`RECENT_DAYS`) | photos imported in the 30 days up to the latest import, newest import first, grouped by import day |
| LR-LIB-BYDATE | Browse by date | P1 | ✅ | `cmd:library.filter` (`date`), `crates/ui-egui/src/panels/left.rs` (`date_row`), `crates/catalog/src/query.rs` (`date_groups`) | year → month → day tree with library-wide counts; a row filters the current source by that date. Active filters show as removable chips under the grid header (`crates/ui-egui/src/panels/chips.rs`, with “+N more” and Clear all), the header counts “N of M photos” (matching of the source's total), a badge on the top-bar filter icon counts them, and an empty result says no photos match the active filters |
| LR-LIB-ALBUM | Albums | P0 | ✅ | `cmd:album.create`, `cmd:album.rename`, `cmd:album.delete`, `cmd:album.addPhotos`, `cmd:album.removePhotos`, `cmd:dialog.newAlbum`, `crates/engine/src/tests_albums_local.rs`, `crates/ui-egui/src/tests_panels.rs` | photos dragged from the grid onto an album row are added to it (LR-BEHAV-DRAGDROP); albums hold library photos (issue #684): `album.create {addSelected}`, `album.addPhotos` and `album.toggleTarget` (B) skip browsed Local photos and return `skipped` (a toast says so), a Local-only selection is an error and leaves Photo ▸ Add to Album, the grid's right-click Add to Album, a folder row's Add Selected Photos and a drop onto an album row off with the hint to Add to My Photos first (`button:contextAddToAlbum`, `button:contextAlbum:<id>`) |
| LR-LIB-ALBUM | Albums | P0 | ✅ | `cmd:album.create`, `cmd:album.rename`, `cmd:album.delete`, `cmd:album.addPhotos`, `cmd:album.removePhotos`, `cmd:dialog.newAlbum`, `crates/engine/src/tests_albums_local.rs`, `crates/ui-egui/src/tests_panels.rs` | photos dragged from the grid onto an album row are added to it (LR-BEHAV-DRAGDROP); albums hold library photos (issue #684): `album.create {addSelected}`, `album.addPhotos` and `album.toggleTarget` (B) skip browsed Local photos and return `skipped` (a toast says so), a Local-only selection is an error and leaves Photo ▸ Add to Album, the grid's right-click Add to Album, a folder row's Add Selected Photos and a drop onto an album row off with the hint to Add to My Photos first (`button:contextAddToAlbum`, `button:contextAlbum:<id>`); right-click a photo ▸ Add to Album lists the albums and ends with New Album…, which creates one holding the selection — also when the library has no album yet (issue #676; `button:contextNewAlbum`) |
| LR-LIB-FOLDER | Folders of albums | P0 | ✅ | `cmd:album.create` (`folder`, `parent`), `cmd:album.move`, `cmd:album.reorder`, `cmd:album.sort`, `cmd:dialog.newAlbum` / `cmd:dialog.newFolder` / `cmd:dialog.smartAlbum` / `cmd:dialog.newSmartAlbum` (`parent`), `crates/ui-egui/src/panels/left.rs` (`albums_tree`, `folder_menu`, `disclosure_triangle`), `crates/ui-egui/src/tests_panels.rs` | Delete removes a folder and its nested albums as one undoable edit, keeps photos in the library and returns a deleted album view to All Photos (issue #501); folders nest and fold with the same disclosure triangle as Local / By Date / Folders / Keywords (`albumToggle:<id>`; the row folds them too; open by default); right-click a folder ▸ New ▸ Create Album… / Create Smart Album… / Create Smart Album from Filter… / Create Folder… creates inside it (the `dialog.new*` commands take `parent`), opening the folders down to the new row; creating is only allowed inside folders; moving: drag an album or folder row onto a folder (outlined when allowed; a closed folder opens after 0.6 s under the pointer; the "Albums" header takes an item that sits in a folder back to the top level while it is dragged), the Move to menu or `album.move` — one undo step each; not onto a plain album, itself or something inside it; drop on the top / bottom half of an album or the edge of a folder to place it there by hand (`cmd:album.reorder`, a line shows the place; ordered per folder, folders stay first, new albums go after the ordered ones; right-click ▸ Sort Contents A–Z or + ▸ Sort Albums A–Z = `cmd:album.sort`) |
| LR-LIB-SMARTALBUM | Smart albums | P1 | ✅ | `cmd:album.createSmart`, `cmd:album.setRules`, `crates/catalog/src/query.rs`, `crates/ui-egui/src/panels/filterbar.rs`, `crates/ui-egui/src/lib.rs` (`album_counts`) | saved filters (rating/flag/label/kind/edited/keyword/camera/lens/date range/text/album) or a rule set from the rule editor (match all / any / none, nested groups; see LRC-LIB-SMARTCOLL), live; sidebar counts are cached per catalog revision (and per minute while an “in the last…” rule is used), counted without building id lists |
| LR-LIB-SHARED-ALBUM | Shared albums | P2 | ⬜ | | needs a sharing service |