diff --git a/crates/ui-egui/src/panels/topbar.rs b/crates/ui-egui/src/panels/topbar.rs index 35e24a781b..407fc5f02f 100644 --- a/crates/ui-egui/src/panels/topbar.rs +++ b/crates/ui-egui/src/panels/topbar.rs @@ -172,9 +172,9 @@ fn filter_button(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, sr: Rec fn right_icons(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, full: Rect) -> f32 { // right icons let mut x = full.right() - 18.0; - // saving is failing: the cloud icon turns into a warning until a save succeeds + // saving is failing: a warning shows until a save succeeds (nothing is shown otherwise) let unsaved = app.session.unsaved().map(|(n, e)| unsaved_tip(n, e)); - let cloud_tip = unsaved.as_deref().unwrap_or("Local library — no cloud account needed"); + let cloud_tip = unsaved.as_deref().unwrap_or_default(); // Import Photos… beside Export, always one click away, with the key it is bound to now let mac = ui.ctx().os() == egui::os::OperatingSystem::Mac; let import_tip = match crate::shortcuts::shortcut_of(&app.ui.settings.keymap, "file.addPhotos") { @@ -189,6 +189,10 @@ fn right_icons(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, full: Rec ("import", Icon::Plus, import_tip.as_str(), "file.addPhotos"), ("bell", Icon::Bell, "Activity", "panel.activity"), ] { + let warn = id == "cloud" && unsaved.is_some(); + if id == "cloud" && !warn { + continue; + } let r = Rect::from_center_size(pos2(x, full.center().y), vec2(28.0, 28.0)); let tip = crate::i18n::tr(tip); let resp = ui.interact(r, egui::Id::unique(("top", id)), Sense::click()); @@ -196,7 +200,6 @@ fn right_icons(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, full: Rec let resp = resp.on_hover_text(tip); crate::widgets::announce(&resp, name); register(ui, format!("icon:{id}"), r); - let warn = id == "cloud" && unsaved.is_some(); let colour = if warn { t.caution } else if resp.hovered() { diff --git a/crates/ui-egui/src/tests/appearance.rs b/crates/ui-egui/src/tests/appearance.rs index 3703f02193..0579fe474e 100644 --- a/crates/ui-egui/src/tests/appearance.rs +++ b/crates/ui-egui/src/tests/appearance.rs @@ -190,6 +190,15 @@ fn the_top_bar_button_and_settings_cards_drive_the_mode() { assert_eq!(crate::theme::current(&h.view.ctx), Some(ThemeKind::Charcoal)); } +#[test] +fn top_bar_has_no_cloud_widget() { + // LightCraft has no cloud service: the icon only shows as the warning that saving is failing + // (`tests/unsaved.rs`), not as a button that does nothing. + let mut h = Headless::new(app(), [1400.0, 900.0], 1.0); + h.settle(T); + assert!(!h.app.widgets.iter().any(|(id, _)| id == "icon:cloud"), "the top bar still registers a dead cloud button"); +} + #[test] fn interface_settings_fit_small_windows_and_stack_theme_choices() { // Desktop windows have a 900×560 minimum; also stress a smaller headless viewport.