diff --git a/gui/src/app/mod.rs b/gui/src/app/mod.rs index 6205db8e..acae0d6c 100644 --- a/gui/src/app/mod.rs +++ b/gui/src/app/mod.rs @@ -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 { - 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 + } } } diff --git a/gui/src/installer/mod.rs b/gui/src/installer/mod.rs index fe375207..29fd1cc4 100644 --- a/gui/src/installer/mod.rs +++ b/gui/src/installer/mod.rs @@ -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 { - 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 + } } } diff --git a/gui/ui/src/color.rs b/gui/ui/src/color.rs index dcd7726d..54b9166e 100644 --- a/gui/ui/src/color.rs +++ b/gui/ui/src/color.rs @@ -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, +); diff --git a/gui/ui/src/component/mod.rs b/gui/ui/src/component/mod.rs index 19e24b37..06ec126f 100644 --- a/gui/ui/src/component/mod.rs +++ b/gui/ui/src/component/mod.rs @@ -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) +} diff --git a/gui/ui/src/theme.rs b/gui/ui/src/theme.rs index d6c8096f..32c35ce6 100644 --- a/gui/ui/src/theme.rs +++ b/gui/ui/src/theme.rs @@ -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() + }, }, } }