diff --git a/gui/src/installer/step/descriptor.rs b/gui/src/installer/step/descriptor.rs index f69459046..c3e49b537 100644 --- a/gui/src/installer/step/descriptor.rs +++ b/gui/src/installer/step/descriptor.rs @@ -183,11 +183,12 @@ impl Setup { } pub struct DefineDescriptor { + data_dir: Option, + setup: HashMap, + network: Network, network_valid: bool, use_taproot: bool, - data_dir: Option, - setup: HashMap, modal: Option>, signer: Arc>, @@ -203,7 +204,6 @@ impl DefineDescriptor { setup: HashMap::from([(Network::Bitcoin, Setup::new())]), data_dir: None, network_valid: true, - modal: None, signer, error: None, diff --git a/gui/src/installer/view.rs b/gui/src/installer/view.rs index 4c60ed3d5..283779e3e 100644 --- a/gui/src/installer/view.rs +++ b/gui/src/installer/view.rs @@ -175,32 +175,26 @@ pub fn welcome<'a>() -> Element<'a, Message> { #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum DescriptorKind { - Legacy, + P2WSH, Taproot, } -const DESCRIPTOR_KINDS: [DescriptorKind; 2] = [DescriptorKind::Legacy, DescriptorKind::Taproot]; +const DESCRIPTOR_KINDS: [DescriptorKind; 2] = [DescriptorKind::P2WSH, DescriptorKind::Taproot]; impl std::fmt::Display for DescriptorKind { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { - Self::Legacy => write!(f, "Default"), + Self::P2WSH => write!(f, "P2WSH"), Self::Taproot => write!(f, "Taproot"), } } } #[allow(clippy::too_many_arguments)] -pub fn define_descriptor<'a>( - progress: (usize, usize), +pub fn define_descriptor_advanced_settings<'a>( network: bitcoin::Network, network_valid: bool, use_taproot: bool, - spending_keys: Vec>, - spending_threshold: usize, - recovery_paths: Vec>, - valid: bool, - error: Option<&String>, ) -> Element<'a, Message> { let col_network = Column::new() .spacing(10) @@ -210,7 +204,7 @@ pub fn define_descriptor<'a>( Message::Network(net.into()) }) .style(if network_valid { - theme::PickList::Simple + theme::PickList::Secondary } else { theme::PickList::Invalid }) @@ -224,14 +218,14 @@ pub fn define_descriptor<'a>( let col_wallet = Column::new() .spacing(10) - .push(text("Wallet").bold()) + .push(text("Descriptor type").bold()) .push(container( pick_list( &DESCRIPTOR_KINDS[..], Some(if use_taproot { DescriptorKind::Taproot } else { - DescriptorKind::Legacy + DescriptorKind::P2WSH }), |kind| Message::CreateTaprootDescriptor(kind == DescriptorKind::Taproot), ) @@ -239,6 +233,41 @@ pub fn define_descriptor<'a>( .padding(10), )); + container( + Column::new() + .spacing(20) + .push(Space::with_height(0)) + .push(separation().width(500)) + .push( + Row::new() + .push(col_network) + .push(Space::with_width(100)) + .push(col_wallet), + ) + .push_maybe(if use_taproot { + Some( + p1_regular("Taproot is only supported by Liana version 5.0 and above") + .style(color::GREY_2), + ) + } else { + None + }), + ) + .into() +} + +#[allow(clippy::too_many_arguments)] +pub fn define_descriptor<'a>( + progress: (usize, usize), + network: bitcoin::Network, + network_valid: bool, + use_taproot: bool, + spending_keys: Vec>, + spending_threshold: usize, + recovery_paths: Vec>, + valid: bool, + error: Option<&String>, +) -> Element<'a, Message> { let col_spending_keys = Column::new() .push( Row::new() @@ -301,13 +330,6 @@ pub fn define_descriptor<'a>( .push( Column::new() .width(Length::Fill) - .push( - Row::new() - .push(col_network) - .push(Space::with_width(Length::Fixed(100.0))) - .push(col_wallet) - .align_items(Alignment::Start), - ) .push( Column::new() .spacing(25) @@ -341,6 +363,29 @@ pub fn define_descriptor<'a>( }), ) .push_maybe(error.map(|e| card::error("Failed to create descriptor", e.to_string()))) + .push(collapse::Collapse::new( + || { + Button::new( + Row::new() + .align_items(Alignment::Center) + .spacing(10) + .push(text("Advanced settings").small().bold()) + .push(icon::collapse_icon()), + ) + .style(theme::Button::Transparent) + }, + || { + Button::new( + Row::new() + .align_items(Alignment::Center) + .spacing(10) + .push(text("Advanced settings").small().bold()) + .push(icon::collapsed_icon()), + ) + .style(theme::Button::Transparent) + }, + move || define_descriptor_advanced_settings(network, network_valid, use_taproot), + )) .push(Space::with_height(Length::Fixed(20.0))) .spacing(50), false, diff --git a/gui/ui/src/theme.rs b/gui/ui/src/theme.rs index a55767e44..e6a239825 100644 --- a/gui/ui/src/theme.rs +++ b/gui/ui/src/theme.rs @@ -473,7 +473,7 @@ impl pick_list::StyleSheet for Theme { border_width: 1.0, border_color: color::GREY_3, border_radius: 25.0, - text_color: color::GREY_3, + text_color: color::GREY_2, }, } }