Add blue banner for testing network
This commit is contained in:
parent
be343aec37
commit
dee083c6d1
@ -20,7 +20,10 @@ use tokio::runtime::Handle;
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
pub use liana::{commands::CoinStatus, config::Config as DaemonConfig, miniscript::bitcoin};
|
||||
use liana_ui::widget::Element;
|
||||
use liana_ui::{
|
||||
component::network_banner,
|
||||
widget::{Column, Element},
|
||||
};
|
||||
|
||||
pub use config::Config;
|
||||
pub use message::Message;
|
||||
@ -318,6 +321,11 @@ impl App {
|
||||
}
|
||||
|
||||
pub fn view(&self) -> Element<Message> {
|
||||
self.panels.current().view(&self.cache).map(Message::View)
|
||||
let content = self.panels.current().view(&self.cache).map(Message::View);
|
||||
if self.cache.network != bitcoin::Network::Bitcoin {
|
||||
Column::with_children(vec![network_banner(self.cache.network).into(), content]).into()
|
||||
} else {
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,8 +5,11 @@ mod step;
|
||||
mod view;
|
||||
|
||||
use iced::{clipboard, Command, Subscription};
|
||||
use liana::miniscript::bitcoin;
|
||||
use liana_ui::widget::Element;
|
||||
use liana::miniscript::bitcoin::{self, Network};
|
||||
use liana_ui::{
|
||||
component::network_banner,
|
||||
widget::{Column, Element},
|
||||
};
|
||||
use tracing::{error, info, warn};
|
||||
|
||||
use context::Context;
|
||||
@ -252,10 +255,17 @@ impl Installer {
|
||||
}
|
||||
|
||||
pub fn view(&self) -> Element<Message> {
|
||||
self.steps
|
||||
let content = self
|
||||
.steps
|
||||
.get(self.current)
|
||||
.expect("There is always a step")
|
||||
.view(&self.hws, self.progress())
|
||||
.view(&self.hws, self.progress());
|
||||
|
||||
if self.network != Network::Bitcoin {
|
||||
Column::with_children(vec![network_banner(self.network).into(), content]).into()
|
||||
} else {
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -55,3 +55,9 @@ pub const RED: Color = Color::from_rgb(
|
||||
|
||||
pub const ORANGE: Color =
|
||||
Color::from_rgb(0xFF as f32 / 255.0, 0xa7 as f32 / 255.0, 0x0 as f32 / 255.0);
|
||||
|
||||
pub const BLUE: Color = Color::from_rgb(
|
||||
0x7D as f32 / 255.0,
|
||||
0xD3 as f32 / 255.0,
|
||||
0xFC as f32 / 255.0,
|
||||
);
|
||||
|
||||
@ -12,14 +12,41 @@ pub mod text;
|
||||
pub mod toast;
|
||||
pub mod tooltip;
|
||||
|
||||
use bitcoin::Network;
|
||||
pub use tooltip::tooltip;
|
||||
|
||||
use iced::Length;
|
||||
|
||||
use crate::{theme, widget::*};
|
||||
|
||||
use self::text::Text;
|
||||
|
||||
pub fn separation<'a, T: 'a>() -> Container<'a, T> {
|
||||
Container::new(Column::new().push(Text::new(" ")))
|
||||
Container::new(Column::new().push(text::text(" ")))
|
||||
.style(theme::Container::Border)
|
||||
.height(Length::Fixed(1.0))
|
||||
}
|
||||
|
||||
pub fn network_banner<'a, T: 'a>(network: Network) -> Container<'a, T> {
|
||||
Container::new(
|
||||
Row::new()
|
||||
.push(super::icon::warning_icon())
|
||||
.push(text::text("THIS IS A "))
|
||||
.push(
|
||||
text::text(match network {
|
||||
Network::Signet => "SIGNET WALLET",
|
||||
Network::Testnet => "TESTNET WALLET",
|
||||
Network::Regtest => "REGTEST WALLET",
|
||||
_ => unreachable!(),
|
||||
})
|
||||
.bold(),
|
||||
)
|
||||
.push(text::text(", COINS HAVE "))
|
||||
.push(text::text("NO VALUE").bold())
|
||||
.align_items(iced::Alignment::Center),
|
||||
)
|
||||
.padding(5)
|
||||
.width(Length::Fill)
|
||||
.center_x()
|
||||
.style(theme::Container::Banner)
|
||||
}
|
||||
|
||||
@ -91,6 +91,7 @@ pub enum Container {
|
||||
Background,
|
||||
Foreground,
|
||||
Border,
|
||||
Banner,
|
||||
Card(Card),
|
||||
Badge(Badge),
|
||||
Pill(Pill),
|
||||
@ -142,6 +143,16 @@ impl container::StyleSheet for Theme {
|
||||
},
|
||||
..container::Appearance::default()
|
||||
},
|
||||
Container::Banner => container::Appearance {
|
||||
background: Some(color::WHITE.into()),
|
||||
border: iced::Border {
|
||||
color: color::TRANSPARENT,
|
||||
width: 0.0,
|
||||
radius: 0.0.into(),
|
||||
},
|
||||
text_color: color::LIGHT_BLACK.into(),
|
||||
..container::Appearance::default()
|
||||
},
|
||||
},
|
||||
Theme::Dark => match style {
|
||||
Container::Transparent => container::Appearance {
|
||||
@ -182,6 +193,16 @@ impl container::StyleSheet for Theme {
|
||||
},
|
||||
..container::Appearance::default()
|
||||
},
|
||||
Container::Banner => container::Appearance {
|
||||
background: Some(color::BLUE.into()),
|
||||
border: iced::Border {
|
||||
color: color::TRANSPARENT,
|
||||
width: 0.0,
|
||||
radius: 0.0.into(),
|
||||
},
|
||||
text_color: color::LIGHT_BLACK.into(),
|
||||
..container::Appearance::default()
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user