LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
LR-BEHAV-SIDEBAR-SECTIONS: review fixes for the header button and the pinned header
Nathaniel Ledford02a21b860d43
diff --git a/crates/ui-egui/src/panels/dialogs.rs b/crates/ui-egui/src/panels/dialogs.rsindex aa287c952..9c8d9a5d0 100644--- a/crates/ui-egui/src/panels/dialogs.rs+++ b/crates/ui-egui/src/panels/dialogs.rs@@ -764,6 +764,7 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context) {export_synonyms,person,add_to_selected,+ ..} => {ui.label(egui::RichText::new(crate::i18n::tr("Keyword Name")).color(t.text_dim));// several fields: the name takes the focus when the dialog opens, not after@@ -1260,6 +1261,7 @@ pub fn confirm_dialog(app: &mut LightcraftApp, dlg: &Dialog) -> Result<serde_jsoexport_synonyms,person,add_to_selected,+ reveal,} => {let mut params = json!({"synonyms": synonyms.split(',').map(str::trim).filter(|s| !s.is_empty()).collect::<Vec<_>>(),@@ -1286,7 +1288,11 @@ pub fn confirm_dialog(app: &mut LightcraftApp, dlg: &Dialog) -> Result<serde_jsoparams["name"] = json!(name);params["parent"] = if *inside { json!(parent) } else { serde_json::Value::Null };params["addToSelected"] = json!(add_to_selected);- app.run("keyword.create", params)+ let r = app.run("keyword.create", params);+ if *reveal && let Ok(made) = &r {+ app.ui.reveal_keyword = made["keyword"].as_str().map(str::to_string);+ }+ r}}}diff --git a/crates/ui-egui/src/panels/keyword_list.rs b/crates/ui-egui/src/panels/keyword_list.rsindex 2e680f2b7..f66c5c86e 100644--- a/crates/ui-egui/src/panels/keyword_list.rs+++ b/crates/ui-egui/src/panels/keyword_list.rs@@ -384,6 +384,7 @@ pub(crate) fn create_dialog_inside(app: &LightcraftApp, parent: Option<String>)export_synonyms: d.export_synonyms,person: d.person,add_to_selected: false,+ reveal: false,}}@@ -402,6 +403,7 @@ pub(crate) fn edit_dialog(app: &LightcraftApp, path: &str) -> Dialog {export_synonyms: info.export_synonyms,person: info.person,add_to_selected: false,+ reveal: false,}}diff --git a/crates/ui-egui/src/panels/left.rs b/crates/ui-egui/src/panels/left.rsindex eb364a450..82b7a978d 100644--- a/crates/ui-egui/src/panels/left.rs+++ b/crates/ui-egui/src/panels/left.rs@@ -363,7 +363,7 @@ pub fn section_drag_feedback(app: &mut LightcraftApp, ctx: &egui::Context) {/// A section's header in `r`: a disclosure chevron in the gutter (where tree rows have their/// triangle), then the bold title; a click folds or unfolds the section (kept in the UI state, so-/// it survives restarts), and what the section adds to its header (Albums: the + menu) sits at+/// it survives restarts), and what the section adds to its header (its button, see `header_button`) sits at/// the visible edge. A folded section says how many rows it holds (`rows`, with View ▸ Show Photo/// Counts). `pinned`: this is the copy kept at the top of the sidebar (see `pinned_header`).fn section_header(app: &mut LightcraftApp, ui: &mut egui::Ui, section: SidebarSection, r: Rect, rows: usize, pinned: bool) -> HeaderOutcome {@@ -377,8 +377,12 @@ fn section_header(app: &mut LightcraftApp, ui: &mut egui::Ui, section: SidebarSeif toggled {app.ui.sidebar.toggle_collapsed(section);}- // dragged by its header, a section moves among the others (see `section_drag`)- if resp.drag_started_by(egui::PointerButton::Primary) {+ // dragged by its header, a section moves among the others (see `section_drag`); a press on+ // the header's button is the button's, also when it turns into a drag+ let on_button = header_button(section).is_some() && ui.input(|i| i.pointer.press_origin()).is_some_and(|p| header_button_rect(ui, r).contains(p));+ if resp.drag_started_by(egui::PointerButton::Primary) && !on_button {+ // picked up by the pinned header, the drag starts inside the top edge (see `drag_auto_scroll`)+ ui.data_mut(|d| d.insert_temp(egui::Id::new("left-section-drag-from-pinned"), pinned));app.ui.dragging_section = Some(section);}resp.context_menu(|ui| sections_menu(app, ui, Some(section)));@@ -450,15 +454,17 @@ fn header_button(section: SidebarSection) -> Option<HeaderButton> {}}+/// The end of `header` kept for its button: at the visible edge, also when the sidebar is+/// scrolled sideways.+fn header_button_rect(ui: &egui::Ui, header: Rect) -> Rect {+ let right = visible_right(ui).min(header.right());+ Rect::from_min_max(pos2(right - 50.0, header.top()), pos2(right, header.bottom()))+}+/// Draw `button` at the end of `header` and act on it.fn show_header_button(app: &mut LightcraftApp, ui: &mut egui::Ui, header: Rect, button: &HeaderButton) {- // it stays at the visible edge when the sidebar is scrolled sideways- let right = visible_right(ui).min(header.right());- let mut hdr = ui.new_child(- egui::UiBuilder::new()- .max_rect(Rect::from_min_max(pos2(right - 50.0, header.top()), pos2(right, header.bottom())))- .layout(egui::Layout::right_to_left(egui::Align::Center)),- );+ let mut hdr =+ ui.new_child(egui::UiBuilder::new().max_rect(header_button_rect(ui, header)).layout(egui::Layout::right_to_left(egui::Align::Center)));let resp = icon_button(&mut hdr, button.id, button.icon, vec2(HEADER_BUTTON, HEADER_BUTTON), false, true, button.tooltip);match button.action {HeaderAction::Run(run) => {@@ -474,8 +480,13 @@ fn show_header_button(app: &mut LightcraftApp, ui: &mut egui::Ui, header: Rect,/// Keywords' +: Create Keyword Tag, for a keyword at the usual place for new ones (not inside/// whatever is picked in the Keyword List, which may not even be on screen).+/// Made from here, the keyword is shown here: Keywords opens down to it (`reveal_keyword`).fn new_keyword(app: &mut LightcraftApp, _ctx: &egui::Context) {- app.ui.dialog = Some(crate::panels::keyword_list::create_dialog_inside(app, None));+ let mut dialog = crate::panels::keyword_list::create_dialog_inside(app, None);+ if let crate::state::Dialog::KeywordTag { reveal, .. } = &mut dialog {+ *reveal = true;+ }+ app.ui.dialog = Some(dialog);}/// The menu of a section's header (`on`) and of the My Photos title (`None`): hide this section,@@ -600,6 +611,19 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {// …and Albums itself is shown and opened, so the new album can be seenapp.ui.sidebar.reveal(SidebarSection::Albums);}+ // the keyword just made from Keywords' header: the section and the keywords above it open+ if let Some(path) = app.ui.reveal_keyword.take() {+ app.ui.sidebar.reveal(SidebarSection::Keywords);+ let mut above = String::new();+ let mut names = path.split('|').peekable();+ while let Some(name) = names.next().filter(|_| names.peek().is_some()) {+ if !above.is_empty() {+ above.push('|');+ }+ above.push_str(name);+ set_tree_open(ui, egui::Id::new(("kw-open", above.to_lowercase())), true);+ }+ }// Local keeps track of the folder being browsed whether or not it is drawnlet local = local_now(app, ui);let shown: Vec<SidebarSection> = app.ui.sidebar.shown().collect();@@ -1196,9 +1220,13 @@ fn drag_auto_scroll(app: &LightcraftApp, ui: &egui::Ui) {let view = ui.clip_rect();let Some(p) = ui.input(|i| i.pointer.latest_pos()).filter(|p| p.x >= view.left() && p.x <= view.right()) else { return };// a section picked up by its pinned header starts inside the top edge: it scrolls once it has- // left the header (albums and photos scroll there as at any edge, to reach the rows above)- if app.ui.dragging_section.is_some() && pointer_on_pinned_header(ui) {- return;+ // left the header. Any other drag scrolls there as at any edge, to reach what is above+ let from_pinned = egui::Id::new("left-section-drag-from-pinned");+ if app.ui.dragging_section.is_some() && ui.data(|d| d.get_temp::<bool>(from_pinned)) == Some(true) {+ if pointer_on_pinned_header(ui) {+ return;+ }+ ui.data_mut(|d| d.insert_temp(from_pinned, false));}let speed = auto_scroll_speed(p.y, view.top(), view.bottom());if speed != 0.0 {diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rsindex 01778290d..df9c0e496 100644--- a/crates/ui-egui/src/state.rs+++ b/crates/ui-egui/src/state.rs@@ -418,6 +418,9 @@ pub struct UiState {/// An album just made: the Albums tree opens the folders down to it, once.#[serde(skip)]pub reveal_album: Option<u64>,+ /// A keyword just made from the sidebar: Keywords opens down to it, once.+ #[serde(skip)]+ pub reveal_keyword: Option<String>,/// An album or folder row being dragged in the sidebar (dropped on a folder to move it there).#[serde(skip)]pub dragging_album: Option<u64>,@@ -610,6 +613,9 @@ pub enum Dialog {person: bool,/// A new keyword is given to the selected photos.add_to_selected: bool,+ /// Opened from the sidebar's Keywords header: the new keyword is shown there once made.+ #[serde(default)]+ reveal: bool,},/// Edit Keyword Set: a set's name and its nine slots (an empty one is an empty slot). `replaces`:/// the set being edited (renamed when the name changes); `None` saves a new set (from Recent@@ -848,6 +854,7 @@ impl Default for UiState {quit: false,dragging_photos: None,reveal_album: None,+ reveal_keyword: None,dragging_album: None,dragging_section: None,curve_channel: "parametric".into(),diff --git a/crates/ui-egui/src/tests_panels.rs b/crates/ui-egui/src/tests_panels.rsindex 2aa08f5ba..c35b0fa89 100644--- a/crates/ui-egui/src/tests_panels.rs+++ b/crates/ui-egui/src/tests_panels.rs@@ -555,6 +555,13 @@ fn dragging_a_section_is_not_dragging_an_album() {h.step();h.step();assert_eq!(h.app.session.catalog.revision, before, "no album moved");+ assert!(!h.app.ui.sidebar.is_default(), "the section did");+ // …and an album dragged onto another section's header moves no section+ let album = h.app.session.catalog.albums().find(|a| !a.folder).expect("the demo library has albums").id.0;+ let arranged = h.app.ui.sidebar.clone();+ let (from, to) = (widget(&h, &format!("source:album:{album}")).center(), header(&h, "keywords").center());+ drag_between(&mut h, from, to, Vec::new());+ assert_eq!((h.app.ui.sidebar.clone(), h.app.ui.dragging_section), (arranged, None));}/// Given a section's header menu, Move Up and Move Down move it one shown section at a time@@ -717,9 +724,8 @@ fn the_header_of_a_long_section_stays_in_sight() {h.settle(SETTLE);assert!(h.app.ui.sidebar_section_collapsed("albums"));assert!(!has(&h, "sidebarSectionPinned:albums"), "a folded section has no rows to pin its header over");- let panel = widget(&h, "panel:left_panel");let own = header(&h, "albums");- assert!(own.top() >= panel.top() && own.bottom() <= panel.bottom(), "its own header is in view: {own:?}");+ assert!((own.top() - pinned.top()).abs() < 1.0, "its own header is where the pinned one was, at the top of the list: {own:?} {pinned:?}");}/// Scroll the sidebar (the pointer over it) by `dy`.@@ -764,6 +770,78 @@ fn a_drop_on_the_pinned_header_is_not_a_drop_on_the_row_beneath_it() {assert_eq!(parent(&h), None, "to the top level, as the header said");}+/// Given a long section scrolled so that its header is pinned, when another section is dragged up+/// to the top edge, then the sidebar scrolls up to reach the sections above, although the pointer+/// is over the pinned header there. A section picked up by the pinned header itself does not+/// start scrolling until the pointer has left it.+#[test]+fn a_section_dragged_to_the_top_edge_scrolls_past_the_pinned_header() {+ let mut h = demo([1400.0, 700.0], json!({"view": "photoGrid", "leftPanel": true}));+ for i in 0..40 {+ h.app.session.execute("album.create", &json!({"name": format!("Album {i:02}")})).unwrap();+ }+ h.step();+ let press = |h: &mut Headless, at: egui::Pos2| {+ h.app.synthetic.push(egui::Event::PointerMoved(at));+ h.app.synthetic.push(egui::Event::PointerButton {+ pos: at,+ button: egui::PointerButton::Primary,+ pressed: true,+ modifiers: egui::Modifiers::NONE,+ });+ h.step();+ };+ let hold = |h: &mut Headless, at: egui::Pos2, frames: usize| {+ for _ in 0..frames {+ h.app.synthetic.push(egui::Event::PointerMoved(at));+ h.step();+ }+ };+ let give_up = |h: &mut Headless| {+ h.app.synthetic.push(egui::Event::Key {+ key: egui::Key::Escape,+ physical_key: None,+ pressed: true,+ repeat: false,+ modifiers: egui::Modifiers::NONE,+ });+ h.step();+ h.app.synthetic.push(egui::Event::PointerButton {+ pos: egui::pos2(800.0, 400.0),+ button: egui::PointerButton::Primary,+ pressed: false,+ modifiers: egui::Modifiers::NONE,+ });+ h.step();+ h.step();+ };+ // Local's header is in view below the albums, Albums' is pinned+ for _ in 0..12 {+ if has(&h, "sidebarSectionPinned:albums") && header(&h, "byDate").top() < 600.0 {+ break;+ }+ scroll_sidebar(&mut h, -200.0);+ }+ let pinned = widget(&h, "sidebarSectionPinned:albums");+ let own = |h: &Headless| header(h, "albums").top();+ // picked up by the pinned header: held inside it, nothing scrolls+ let start = own(&h);+ press(&mut h, pinned.center());+ hold(&mut h, pinned.center() + egui::vec2(12.0, 3.0), 12);+ assert_eq!(h.app.ui.dragging_section, Some(crate::sidebar::SidebarSection::Albums));+ assert_eq!(own(&h), start, "still on the header it was picked up by");+ give_up(&mut h);+ // By Date, picked up by its own header and taken to the top edge: the sidebar scrolls up+ let start = own(&h);+ let from = header(&h, "byDate").center();+ press(&mut h, from);+ hold(&mut h, from - egui::vec2(0.0, 60.0), 3);+ hold(&mut h, pinned.center(), 30);+ assert!(own(&h) > start + 20.0, "scrolled towards the sections above: {start} -> {}", own(&h));+ give_up(&mut h);+ assert!(h.app.ui.sidebar.is_default());+}+/// The pinned header belongs to the section whose rows are at the top of the sidebar: scrolling on/// into the next section pushes it out and pins that section's header instead.#[test]@@ -813,8 +891,8 @@ fn the_keywords_header_creates_a_keyword() {assert!(has(&h, "source:keyword:zebra crossing"), "the new keyword is listed");}-/// A section's header button is part of every form of the header: folded (its row count sits to-/// the left of the button) and pinned.+/// A folded section's row count sits to the left of its header button; a section without a button+/// has its count at the edge.#[test]fn a_header_button_stays_with_a_folded_header() {let mut h = demo([1400.0, 1400.0], json!({"view": "photoGrid", "leftPanel": true}));@@ -824,8 +902,71 @@ fn a_header_button_stays_with_a_folded_header() {let (count, plus) = (widget(&h, &format!("sidebarSectionCount:{section}")), widget(&h, button));assert!(count.right() <= plus.left(), "{section}: the count {count:?} is left of the button {plus:?}");}- // sections without a button have none, and their count goes to the edge- assert!(!h.app.widgets.iter().any(|(w, _)| w == "icon:byDateNew" || w == "icon:foldersNew"));+ // By Date has no button: its count goes where the others have theirs+ click(&mut h, "sidebarSection:byDate");+ let (plain, beside_button) = (widget(&h, "sidebarSectionCount:byDate"), widget(&h, "sidebarSectionCount:keywords"));+ assert!(plain.right() >= widget(&h, "icon:keywordNew").left() && plain.right() > beside_button.right() + 20.0, "{plain:?} {beside_button:?}");+}++/// Given Keywords is folded and new keywords go inside a parent, when a keyword is made with the+/// header's +, then Keywords opens, and so does the parent, so the new keyword is there to see.+/// A keyword made elsewhere (the Keyword List) leaves the sidebar as it is.+#[test]+fn a_keyword_made_from_the_header_is_shown() {+ let mut h = demo([1400.0, 1400.0], json!({"view": "photoGrid", "leftPanel": true}));+ exec(&mut h, "keyword.create", json!({"name": "places", "parent": null}));+ exec(&mut h, "keyword.setDefaultParent", json!({"keyword": "places"}));+ click(&mut h, "sidebarSection:keywords");+ assert!(h.app.ui.sidebar_section_collapsed("keywords"));+ let confirm = |h: &mut Headless, name: &str| {+ let Some(crate::state::Dialog::KeywordTag { name: n, .. }) = h.app.ui.dialog.as_mut() else { panic!("{:?}", h.app.ui.dialog) };+ *n = name.into();+ let r = h.request("ui.dialog.confirm", json!({}), T);+ assert_eq!(r["ok"], true, "{r}");+ h.step();+ h.step();+ };+ // from the Keyword List: nothing is revealed+ h.app.ui.dialog = Some(crate::panels::keyword_list::create_dialog(&h.app));+ confirm(&mut h, "harbour");+ assert!(h.app.ui.sidebar_section_collapsed("keywords") && !has(&h, "source:keyword:places|harbour"));+ // from the header's ++ click(&mut h, "icon:keywordNew");+ confirm(&mut h, "lighthouse");+ assert!(!h.app.ui.sidebar_section_collapsed("keywords"), "Keywords opened");+ assert!(has(&h, "source:keyword:places|lighthouse"), "and its parent, down to the new keyword");+}++/// A press on a header's button that turns into a drag is not a drag of the section.+#[test]+fn dragging_from_a_header_button_does_not_drag_the_section() {+ let mut h = demo([1400.0, 1400.0], json!({"view": "photoGrid", "leftPanel": true}));+ for button in ["icon:keywordNew", "icon:albumNew"] {+ let from = widget(&h, button).center();+ h.app.synthetic.push(egui::Event::PointerMoved(from));+ h.app.synthetic.push(egui::Event::PointerButton {+ pos: from,+ button: egui::PointerButton::Primary,+ pressed: true,+ modifiers: egui::Modifiers::NONE,+ });+ h.step();+ for i in 1..=6 {+ h.app.synthetic.push(egui::Event::PointerMoved(from - egui::vec2(8.0 * i as f32, 30.0 * i as f32)));+ h.step();+ assert_eq!(h.app.ui.dragging_section, None, "{button}");+ }+ let to = from - egui::vec2(48.0, 180.0);+ h.app.synthetic.push(egui::Event::PointerButton {+ pos: to,+ button: egui::PointerButton::Primary,+ pressed: false,+ modifiers: egui::Modifiers::NONE,+ });+ h.step();+ h.step();+ }+ assert!(h.app.ui.sidebar.is_default());}/// A folded section says how many rows it holds (unless photo counts are off); an open onediff --git a/docs/parity.md b/docs/parity.mdindex 4e18474f2..7765e3f0d 100644--- a/docs/parity.md+++ b/docs/parity.md@@ -525,10 +525,10 @@ under the UI command that wraps it (a no-op error); the UI command now wins.| LR-BEHAV-RENDER-FIDELITY | Rendering matches Lightroom | P1 | 🟡 | `crates/pipeline/src/lib.rs`, `crates/pipeline/src/tone.rs` | every slider exists and works, but the character of the result (tone curve shape, highlight recovery, texture / clarity / dehaze, noise reduction, sharpening, default look) is tuned by eye; there is no systematic side-by-side comparison against Lightroom on the same CC0 raws. Needs a fidelity suite: Lightroom reference renders kept only in the local `plan/` (never committed), compared per slider and preset with a perceptual metric. Tuning that changes how existing settings render ships as a new process version (LRC-DEV-PROCESS, `docs/process-versions.md`) || LR-BEHAV-DRAGDROP | Drag and drop | P1 | ✅ | `crates/ui-egui/src/lib.rs`, `crates/ui-egui/src/panels/grid.rs` (`drag_feedback`), `crates/ui-egui/src/panels/left.rs` (`drop_target`, `album_drag_over`, `top_level_drop_target`, `drag_auto_scroll`) | files → app (import); grid photos → an album row (adds the selection, with a count badge while dragging); sidebar album / folder rows → a folder (moves it; its name follows the pointer); a drag of albums or grid photos near the top or bottom edge of the sidebar scrolls it (faster nearer the edge, only while the pointer is over the sidebar) || LR-BEHAV-TOAST | Toast notifications | P1 | ✅ | `crates/ui-egui/src/panels/mod.rs` | |-| LR-BEHAV-SIDEBAR-COLLAPSE | Collapsible left-sidebar sections | P2 | ✅ | `crates/ui-egui/src/panels/left.rs` (`section`, `section_header`), `crates/ui-egui/src/sidebar.rs` (`SidebarLayout`), `crates/ui-egui/src/tests_panels.rs` | click the Albums, Local, By Date, Folders or Keywords header (or drive `ui.clickWidget` `sidebarSection:<albums\|local\|byDate\|folders\|keywords>`) to fold or unfold the section; a chevron after the title shows the state; the choice is kept across restarts (`sidebar` in the UI state; the `collapsedSidebar` list of older settings files is still read). UI-only (no command), like the By Date / Keywords disclosure triangles; photos dropped on a folded Albums section have no target |-| LR-BEHAV-SIDEBAR-SECTIONS | Left-sidebar sections share one frame and one arrangement | P2 | ✅ | `crates/ui-egui/src/sidebar.rs` (`SidebarSection`, `SidebarLayout`), `crates/ui-egui/src/panels/left.rs` (`section`, `section_header`, `tree_toggle`), `crates/ui-egui/src/tests_panels.rs` | Albums, Local, By Date, Folders and Keywords are drawn by one `section` frame (the same gap above, header, fold and accessibility name) from one arrangement, `sidebar` in the UI state: a list of `{id, hidden, collapsed}` top to bottom, also settable with `ui.set`. Whatever is read, every section is in it exactly once (unknown and repeated entries are dropped, the rest follow in the usual order), so a damaged or newer settings file never loses the other settings. Rows that open (album folders, Local folders, dates, library folders, keywords) share `tree_toggle`: the same triangle, the same remembered open state, announced as Expand / Collapse. A section with nothing to list (Folders before anything is imported, Keywords before any is added) stays, open, with a one-line note in place of rows (`sidebarEmpty:<id>`) instead of disappearing. `ui.set` reads `sidebar` strictly (`SidebarLayout::parse`): an unknown or repeated section, or a flag that is not true / false, is refused and changes nothing; sections left out follow in the usual order, shown and open; the older `collapsedSidebar` list still folds and unfolds. A section may have one button at the end of its header, declared in one place (`header_button`: an icon, a tooltip, and either an action or a menu): the frame draws it at the visible edge in the header and its pinned copy, keeps its click from folding the section and leaves it room beside a folded section's count. Albums has + (`icon:albumNew`: Create Album / Smart Album / Folder…), Keywords has + (`icon:keywordNew`: Create Keyword Tag, for a keyword inside the default parent, not inside what the Keyword List has picked). My Photos (All Photos, Recently Added, Picks, Missing Photos, Recently Deleted) is not a section: it stays on top |+| LR-BEHAV-SIDEBAR-COLLAPSE | Collapsible left-sidebar sections | P2 | ✅ | `crates/ui-egui/src/panels/left.rs` (`section`, `section_header`), `crates/ui-egui/src/sidebar.rs` (`SidebarLayout`), `crates/ui-egui/src/tests_panels.rs` | click the Albums, Local, By Date, Folders or Keywords header (or drive `ui.clickWidget` `sidebarSection:<albums\|local\|byDate\|folders\|keywords>`) to fold or unfold the section; a chevron before the title shows the state; the choice is kept across restarts (`sidebar` in the UI state; the `collapsedSidebar` list of older settings files is still read). the click itself is UI-only, like the By Date / Keywords disclosure triangles, and `cmd:view.sidebarSection` `{section, collapsed}` folds and unfolds for agents; photos dropped on a folded Albums section have no target |+| LR-BEHAV-SIDEBAR-SECTIONS | Left-sidebar sections share one frame and one arrangement | P2 | ✅ | `crates/ui-egui/src/sidebar.rs` (`SidebarSection`, `SidebarLayout`), `crates/ui-egui/src/panels/left.rs` (`section`, `section_header`, `tree_toggle`), `crates/ui-egui/src/tests_panels.rs` | Albums, Local, By Date, Folders and Keywords are drawn by one `section` frame (the same gap above, header, fold and accessibility name) from one arrangement, `sidebar` in the UI state: a list of `{id, hidden, collapsed}` top to bottom, also settable with `ui.set`. Whatever is read, every section is in it exactly once (unknown and repeated entries are dropped, the rest follow in the usual order), so a damaged or newer settings file never loses the other settings. Rows that open (album folders, Local folders, dates, library folders, keywords) share `tree_toggle`: the same triangle, the same remembered open state, announced as Expand / Collapse. A section with nothing to list (Folders before anything is imported, Keywords before any is added) stays, open, with a one-line note in place of rows (`sidebarEmpty:<id>`) instead of disappearing. `ui.set` reads `sidebar` strictly (`SidebarLayout::parse`): an unknown or repeated section, or a flag that is not true / false, is refused and changes nothing; sections left out follow in the usual order, shown and open; the older `collapsedSidebar` list still folds and unfolds. A section may have one button at the end of its header, declared in one place (`header_button`: an icon, a tooltip, and either an action or a menu): the frame draws it at the visible edge in the header and its pinned copy, keeps its click from folding the section and leaves it room beside a folded section's count. Albums has + (`icon:albumNew`: Create Album / Smart Album / Folder…), Keywords has + (`icon:keywordNew`: Create Keyword Tag, for a keyword inside the default parent, not inside what the Keyword List has picked; once made, Keywords is shown and opened down to it). My Photos (All Photos, Recently Added, Picks, Missing Photos, Recently Deleted) is not a section: it stays on top || LR-BEHAV-SIDEBAR-HIDE | Show and hide left-sidebar sections | P2 | ✅ | `cmd:view.sidebarSection`, `cmd:view.sidebarReset`, `crates/ui-egui/src/sidebar.rs`, `crates/ui-egui/src/panels/left.rs` (`sections_menu`), `crates/ui-egui/src/menubar.rs`, `crates/ui-egui/src/tests_panels.rs` | View ▸ Sidebar Sections lists Albums, Local, By Date, Folders and Keywords in the sidebar's order, each checked while shown; unchecking one takes its header and rows off the sidebar, checking it puts it back where and how it was (still folded if it was). The same list opens with a right-click on any section header (with Hide This Section first; widgets `sidebarMenu:hide`, `sidebarMenu:section:<id>`, `sidebarMenu:reset`) and on the My Photos title (`sidebarTitle`), which is always there, so hidden sections can always come back. Reset Sidebar Sections (enabled once something changed) shows and opens every section in the usual order. `view.sidebarSection` `{section, show?, collapsed?}` flips shown / hidden when neither flag is given and refuses an unknown section or a flag that is not true / false. Hiding the section of what the grid shows (an album, a keyword filter) leaves the grid as it is; an album made while Albums is hidden or folded brings Albums back, open. Kept with the UI state (`sidebar`). My Photos itself can't be hidden |-| LR-BEHAV-SIDEBAR-REORDER | Reorder left-sidebar sections | P2 | ✅ | `cmd:view.sidebarMoveSection`, `crates/ui-egui/src/sidebar.rs` (`move_before`, `move_by`), `crates/ui-egui/src/panels/left.rs` (`section_drag`, `section_drop_before`, `section_drag_feedback`), `crates/ui-egui/src/tests_panels.rs` | drag a section by its header: its name follows the pointer, a line (`sidebarSectionDrop`) shows the gap it would go to (above the section whose upper half the pointer is over, or below the last), releasing over the sidebar moves it there, Esc or releasing elsewhere leaves it; the sidebar scrolls when the drag nears its top or bottom edge. A click on the header still folds the section, and an album dragged onto the Albums header is still an album drag. The header's menu has Move Up / Move Down (`sidebarMenu:moveUp` / `moveDown`), one shown section at a time, stepping over hidden ones, disabled at the ends. `view.sidebarMoveSection` `{section, direction: up\|down}` or `{section, before: <section>\|null}` (null: last) answers `{moved, order}`. The order is kept with the UI state (`sidebar`). Recently Deleted is listed with My Photos (below Picks / Missing Photos), not after the sections. Not here: dragging My Photos, or rows from one section into another |+| LR-BEHAV-SIDEBAR-REORDER | Reorder left-sidebar sections | P2 | ✅ | `cmd:view.sidebarMoveSection`, `crates/ui-egui/src/sidebar.rs` (`move_before`, `move_by`), `crates/ui-egui/src/panels/left.rs` (`section_drag`, `section_drop_before`, `section_drag_feedback`), `crates/ui-egui/src/tests_panels.rs` | drag a section by its header: its name follows the pointer, a line (`sidebarSectionDrop`) shows the gap it would go to (above the section whose upper half the pointer is over, or below the last), releasing over the sidebar moves it there, Esc or releasing elsewhere leaves it; the sidebar scrolls when the drag nears its top or bottom edge, also over a pinned header (a section picked up by the pinned header scrolls once the pointer has left it). A press on a header's button is never a section drag. A click on the header still folds the section, and an album dragged onto the Albums header is still an album drag. The header's menu has Move Up / Move Down (`sidebarMenu:moveUp` / `moveDown`), one shown section at a time, stepping over hidden ones, disabled at the ends. `view.sidebarMoveSection` `{section, direction: up\|down}` or `{section, before: <section>\|null}` (null: last) answers `{moved, order}`. The order is kept with the UI state (`sidebar`). Recently Deleted is listed with My Photos (below Picks / Missing Photos), not after the sections. Not here: dragging My Photos, or rows from one section into another || LR-BEHAV-SIDEBAR-STICKY | Pinned section header and section look | P2 | ✅ | `crates/ui-egui/src/panels/left.rs` (`pinned_header`, `section_header`, `empty_hint`), `crates/ui-egui/src/tests_panels.rs` | while the rows of an open section are in view but its header has scrolled away, a copy of the header (`sidebarSectionPinned:<id>`, with the section's buttons and menu) stays at the top of the sidebar; the next section's header pushes it out; folding from it brings the section's own header into view. Rows scrolled beneath the pinned header are covered by it: an album or photos dropped on the pinned Albums header go to the top level / nowhere, never to the row under it; folding from it keeps the sideways scroll. Sections are told apart by a hairline in the gap above each; the fold chevron sits in the gutter, in the column of the rows' triangles (`sidebarSectionChevron:<id>`); a header highlights under the pointer; a folded section shows how many top-level rows it holds (`sidebarSectionCount:<id>`, with Show Photo Counts); a count of 0 is fainter. Not here: a height of its own per section (one scroll area serves the whole sidebar), a count for Recently Added, Local's Browse Folder… as a header button || LR-BEHAV-PANEL-RESIZE | Resizable side panels | P1 | ✅ | `crates/ui-egui/src/panels/mod.rs` (`resizable_side`), `crates/ui-egui/src/state.rs` (`LEFT_WIDTH`, `RIGHT_WIDTH`), `crates/ui-egui/src/tests_panels.rs` | drag the left sidebar's right edge (200–480 pt) or the right panel's left edge (250–520 pt); the photo area keeps ≥ 360 pt; widths are kept across panels, views and restarts (`leftWidth` / `rightWidth` in the UI state); the Presets column stays fixed || LR-BEHAV-EMPTY-STATES | Empty states | P1 | ✅ | `crates/ui-egui/src/panels/mod.rs` (`empty_message`) | |