Merge #389: fix installer pick_list warning

d108a0f48d5efab21af698aead8fe07788985c36 fix installer pick_list warning (edouard)

Pull request description:

  ![2023-03-28T14:10:07,557792143+02:00](https://user-images.githubusercontent.com/6933020/228231883-2da81e02-edb5-4271-9cd4-fc4b81ed5097.png)

ACKs for top commit:
  edouardparis:
    Self-ACK d108a0f48d5efab21af698aead8fe07788985c36

Tree-SHA512: 69e5d60aeb433e10b30073be8342cc438dd454ce782e07b0d3b722e4730fb678b56b6109f9ecd29f8c01e0e7b3be97b306b6090bb9cf3576ba538454aaa7d9a2
This commit is contained in:
edouard 2023-03-28 14:27:08 +02:00
commit 292b94f72c
No known key found for this signature in database
GPG Key ID: E65F7A089C20DC8F
3 changed files with 51 additions and 22 deletions

View File

@ -157,15 +157,20 @@ pub fn define_descriptor<'a>(
pick_list(&NETWORKS[..], Some(Network::from(network)), |net| {
Message::Network(net.into())
})
.style(theme::PickList::Simple)
.style(if network_valid {
theme::PickList::Simple
} else {
theme::PickList::Invalid
})
.padding(10),
))
.push_maybe(if network_valid {
None
} else {
Some(card::warning(
"A data directory already exists for this network".to_string(),
))
Some(
text("A data directory already exists for this network")
.style(color::legacy::ALERT),
)
})
.padding(50);
@ -363,14 +368,20 @@ pub fn import_descriptor<'a>(
pick_list(&NETWORKS[..], Some(Network::from(network)), |net| {
Message::Network(net.into())
})
.style(if network_valid {
theme::PickList::Simple
} else {
theme::PickList::Invalid
})
.padding(10),
))
.push_maybe(if network_valid {
None
} else {
Some(card::warning(
"A data directory already exists for this network".to_string(),
))
Some(
text("A data directory already exists for this network")
.style(color::legacy::ALERT),
)
});
let col_descriptor = Column::new()
.push(text("Descriptor:").bold())
@ -619,14 +630,20 @@ pub fn participate_xpub<'a>(
pick_list(&NETWORKS[..], Some(Network::from(network)), |net| {
Message::Network(net.into())
})
.style(if network_valid {
theme::PickList::Simple
} else {
theme::PickList::Invalid
})
.padding(10),
))
.push_maybe(if network_valid {
None
} else {
Some(card::warning(
"A data directory already exists for this network".to_string(),
))
Some(
text("A data directory already exists for this network")
.style(color::legacy::ALERT),
)
});
layout(

View File

@ -18,8 +18,8 @@ pub fn warning<'a, T: 'a>(message: String) -> Container<'a, T> {
Row::new()
.spacing(20)
.align_items(iced::Alignment::Center)
.push(icon::warning_octagon_icon().style(color::legacy::WARNING))
.push(text(message).style(color::legacy::WARNING)),
.push(icon::warning_octagon_icon())
.push(text(message)),
)
.padding(15)
.style(theme::Container::Card(theme::Card::Warning))

View File

@ -50,7 +50,7 @@ impl iced::overlay::menu::StyleSheet for Theme {
background: color::LIGHT_GREY.into(),
border_width: 1.0,
border_radius: 0.0,
border_color: color::GREEN,
border_color: color::LIGHT_GREY,
selected_text_color: color::BLACK,
selected_background: color::GREEN.into(),
}
@ -422,19 +422,31 @@ impl scrollable::StyleSheet for Theme {
pub enum PickList {
#[default]
Simple,
Invalid,
}
impl pick_list::StyleSheet for Theme {
type Style = PickList;
fn active(&self, _style: &Self::Style) -> pick_list::Appearance {
pick_list::Appearance {
placeholder_color: color::legacy::FOREGROUND,
handle_color: color::legacy::FOREGROUND,
background: color::legacy::FOREGROUND.into(),
border_width: 1.0,
border_color: color::legacy::BORDER_GREY,
border_radius: 10.0,
text_color: iced::Color::BLACK,
fn active(&self, style: &Self::Style) -> pick_list::Appearance {
match style {
PickList::Simple => pick_list::Appearance {
placeholder_color: color::legacy::FOREGROUND,
handle_color: color::legacy::FOREGROUND,
background: color::legacy::FOREGROUND.into(),
border_width: 1.0,
border_color: color::legacy::BORDER_GREY,
border_radius: 10.0,
text_color: iced::Color::BLACK,
},
PickList::Invalid => pick_list::Appearance {
placeholder_color: color::legacy::FOREGROUND,
handle_color: color::legacy::FOREGROUND,
background: color::legacy::FOREGROUND.into(),
border_width: 1.0,
border_color: color::legacy::ALERT,
border_radius: 10.0,
text_color: iced::Color::BLACK,
},
}
}