ui: remove the title-bar Discord button (#1737)

Co-authored-by: highperfocused <[email protected]>
This commit is contained in:
mroxsoandhighperfocused authored and GitHub committed 2026-10-14 13:05:47 -04:00
1 parent 72d4359999
commit b37a148759
3 files changed
+17 -29

No files matched your search

+3 -24
View File
@@ -646,9 +646,9 @@ pub fn title_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
("Pixel Art".to_string(), tl!("Pixel Art")),
("Motion".to_string(), tl!("Motion")),
];
// A narrow bar drops what is also in a menu, Discord first (below), then
// the theme toggle (Preferences), then search (Edit › Search), and narrows
// the switcher (Window › Workspace) before anything runs over.
// A narrow bar drops what is also in a menu, the theme toggle first
// (Preferences), then search (Edit › Search), and narrows the switcher
// (Window › Workspace) before anything runs over.
let room = ui.available_width();
let icons_shown: u8 = if room >= WORKSPACE_MIN + 2.0 * ICON_SLOT {
2
@@ -680,25 +680,6 @@ pub fn title_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
}
button.context_menu(|ui| crate::prefs_ui::appearance_context_menu(app, ui));
}
// The community Discord, one click away while the bar has room for it
// (narrow windows drop it first; it is also Help › Discord).
if ui.available_width() >= DISCORD_ROOM {
let discord = egui::Button::image_and_text(
icons::image("message-square", 14.0, t.text_dim),
egui::RichText::new(tl!("Discord")).color(t.text_dim).size(12.0),
)
.frame(false);
if ui
.add(discord)
.on_hover_text({
let template = "Join the ArtCraft Discord ({url})";
crate::i18n::fmt(tl!(template), &[("url", crate::links::DISCORD)])
})
.clicked()
{
crate::links::open(app, ui.ctx(), crate::links::DISCORD);
}
}
if rtl { ui.min_rect().right() } else { ui.min_rect().left() }
};
free = if rtl { (controls_end, menus_end) } else { (menus_end, controls_end) };
@@ -755,8 +736,6 @@ pub fn sync_window_title(app: &mut PhotocraftApp, ctx: &egui::Context) {
/// Minimum space kept between the window title and the menus or controls beside it.
const TITLE_GAP: f32 = 16.0;
/// Free room the title bar needs after its other controls to show the Discord button.
const DISCORD_ROOM: f32 = 120.0;
/// The workspace switcher's narrowest width, and one 28 pt title-bar icon with its spacing.
const WORKSPACE_MIN: f32 = 90.0;
const ICON_SLOT: f32 = 34.0;
+13 -4
View File
@@ -646,7 +646,7 @@ mod tests {
for width in [760.0, 1100.0, 1440.0] {
let mut w = Win::new(width);
w.frame(vec![]);
let out = w.frame(vec![]);
w.frame(vec![]);
let [min, max, close] = CAPTIONS.map(|c| w.caption(c));
assert_eq!((close.right(), close.top()), (width, 0.0), "Close sits in the window's corner at {width}");
// The bar's bottom point is the panel's separator line, which the buttons leave visible.
@@ -657,9 +657,18 @@ mod tests {
for a in &widgets {
assert!(a.right() <= min.left(), "{a:?} runs into the caption buttons at {width}");
}
// Wide windows show the whole group; the narrowest drops Discord (also Help › Discord).
let has_discord = texts(&out).iter().any(|(t, _)| t == "Discord");
assert_eq!(has_discord, width > 1000.0, "Discord at {width}");
}
}
#[test]
fn the_title_bar_promotes_no_community_chat() {
// Issue #1726: only the always-visible title-bar button is removed. The start-screen
// and About buttons and Help › Discord remain available.
for width in [760.0, 1100.0, 1440.0] {
let mut w = Win::new(width);
w.frame(vec![]);
let out = w.frame(vec![]);
assert!(!texts(&out).iter().any(|(t, _)| t.contains("Discord")), "no Discord in the bar at {width}");
}
}
+1 -1
View File
@@ -97,7 +97,7 @@ The app's top bar (`panels::title_bar`) starts with the brand mark (the app icon
- **Windows and Linux:** the window has no OS decorations, so there is one bar, not two stacked. The top bar is the title bar (`titlebar.rs`): Minimize, Maximize/Restore and Close (red on hover, `caption_close` tokens) sit flush in the window's top-right corner, the free gap between the menus and the controls drags the window and a double-click there maximizes it, and invisible 5 pt edges (12 pt corners) resize it. Close runs File › Exit, so unsaved documents are asked about first.
- **macOS:** the traffic lights sit over the integrated title strip (`integrated_titlebar`).
- **Narrow windows** drop controls that are also in a menu before anything overlaps: Discord (Help › Discord), then the theme toggle, then search (Edit › Search), then the workspace switcher narrows (Window › Workspace).
- **Narrow windows** drop controls that are also in a menu before anything overlaps: the theme toggle (Preferences), then search (Edit › Search), then the workspace switcher narrows (Window › Workspace).
## Compact tool controls