Merge #1699: gui: Improve visibility primary button text & fixes

d2c6f9bb96fa01b8f590fb67f5fdb34eedeca45a fix: "Generate address" become secondary after generation (Thomas Ballivet)
15f4dc1ed145e49f52576c0aaabd0608847c698f fix: set "Go to replacement" as primary (Thomas Ballivet)
881621f03b901198f47f31e44b1599f3dc75df06 Improve visibility of primary button text (Thomas Ballivet)

Pull request description:

  The first commit fixes #1697.
  The second set "Go to replacement" as primary.
  The third make "Generate address" become secondary after generation.
  Tell me if I should squash.

  ![image](https://github.com/user-attachments/assets/6cbf3573-0956-43e5-be70-f2e075f5c314)

  ![Capture d’écran du 2025-05-06 20-47-25](https://github.com/user-attachments/assets/8df30fb6-9ac8-4eb2-9756-9a1fecc921d9)

  I've tried to make the icon thicker but doesn't work the same way. Maybe using a different font or an image would help to fixes this.

ACKs for top commit:
  pythcoiner:
    tACK d2c6f9bb

Tree-SHA512: 5ca6201ac77106dbb866badaeda9a097823dda37630ee437fd816bb749802fcae8a225bad999bbde232f63976dc8a823a09a5a7e593fb889f226b05f4f28a41d
This commit is contained in:
edouardparis 2025-05-16 09:47:51 +02:00
commit b4062b28a9
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
3 changed files with 23 additions and 18 deletions

View File

@ -108,10 +108,15 @@ pub fn receive<'a>(
Row::new()
.align_y(Alignment::Center)
.push(Container::new(h3("Receive")).width(Length::Fill))
.push(
button::primary(Some(icon::plus_icon()), "Generate address")
.on_press(Message::NextReceiveAddress),
),
.push({
let (icon, label) = (Some(icon::plus_icon()), "Generate address");
if addresses.is_empty() {
button::primary(icon, label)
} else {
button::secondary(icon, label)
}
.on_press(Message::NextReceiveAddress)
}),
)
.push(text("Always generate a new address for each deposit."))
.push(

View File

@ -291,7 +291,7 @@ pub fn create_rbf_modal<'a>(
}))
.push_maybe(replacement_txid.map(|id| {
Row::new().push(
button::secondary(None, "Go to replacement")
button::primary(None, "Go to replacement")
.width(Length::Fixed(200.0))
.on_press(Message::Menu(Menu::PsbtPreSelected(id))),
)

View File

@ -1,16 +1,16 @@
use super::text::text;
use crate::font::MEDIUM;
use crate::{theme, widget::*};
use iced::alignment::{Horizontal, Vertical};
use iced::widget::{button, container, row};
use super::text::text;
pub fn menu<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Button<'a, T> {
button::Button::new(content_menu(icon.map(|i| i.style(theme::text::secondary)), t).padding(10))
Button::new(content_menu(icon.map(|i| i.style(theme::text::secondary)), t).padding(10))
.style(theme::button::menu)
}
pub fn menu_active<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Button<'a, T> {
button::Button::new(content_menu(icon.map(|i| i.style(theme::text::secondary)), t).padding(10))
Button::new(content_menu(icon.map(|i| i.style(theme::text::secondary)), t).padding(10))
.style(theme::button::menu_pressed)
}
@ -22,33 +22,33 @@ fn content_menu<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Container
}
pub fn alert<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Button<'a, T> {
button::Button::new(content(icon, t)).style(theme::button::destructive)
Button::new(content(icon, text(t))).style(theme::button::destructive)
}
pub fn primary<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Button<'a, T> {
button::Button::new(content(icon, t)).style(theme::button::primary)
Button::new(content(icon, text(t).font(MEDIUM))).style(theme::button::primary)
}
pub fn transparent<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Button<'a, T> {
button::Button::new(content(icon, t)).style(theme::button::container)
Button::new(content(icon, text(t))).style(theme::button::container)
}
pub fn secondary<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Button<'a, T> {
button::Button::new(content(icon, t)).style(theme::button::secondary)
Button::new(content(icon, text(t))).style(theme::button::secondary)
}
pub fn border<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Button<'a, T> {
button::Button::new(content(icon, t)).style(theme::button::secondary)
Button::new(content(icon, text(t))).style(theme::button::secondary)
}
pub fn transparent_border<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Button<'a, T> {
button(content(icon, t)).style(theme::button::container_border)
button(content(icon, text(t))).style(theme::button::container_border)
}
fn content<'a, T: 'a>(icon: Option<Text<'a>>, t: &'static str) -> Container<'a, T> {
fn content<'a, T: 'a>(icon: Option<Text<'a>>, text: Text<'a>) -> Container<'a, T> {
match icon {
None => container(text(t)).align_x(Horizontal::Center).padding(5),
Some(i) => container(row![i, text(t)].spacing(10).align_y(Vertical::Center))
None => container(text).align_x(Horizontal::Center).padding(5),
Some(i) => container(row![i, text].spacing(10).align_y(Vertical::Center))
.align_x(Horizontal::Center)
.padding(5),
}