Merge #1096: Add a warning in installer if mainnet wallet already exists
d770e62e19687a4e6357ac24f899653d922d9293 Collapse advanced settings menu and grey-out `Next` button in installer if mainnet wallet already exists (pythcoiner) Pull request description: this PR fixes #1039, it add a warning in the installer if an wallet already exists on mainnet & grey-out `Next` button if the network is not valid.  ACKs for top commit: edouardparis: ACK d770e62e19687a4e6357ac24f899653d922d9293 Tree-SHA512: c756804fb89aa9cc8bc1009517f88745521580c8d3128ebfdd5b364280fd56dbdbc7490680e0e7208b6c0e1fb55279ce357f46ad2c312311c5cb6e941d27a214
This commit is contained in:
commit
a12d7f5788
@ -329,29 +329,34 @@ pub fn define_descriptor<'a>(
|
||||
progress,
|
||||
"Create the wallet",
|
||||
Column::new()
|
||||
.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(
|
||||
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)
|
||||
},
|
||||
)
|
||||
.collapsed(!network_valid),
|
||||
)
|
||||
.push(
|
||||
Column::new()
|
||||
.width(Length::Fill)
|
||||
@ -379,7 +384,7 @@ pub fn define_descriptor<'a>(
|
||||
))
|
||||
.width(Length::Fixed(200.0)),
|
||||
)
|
||||
.push(if !valid {
|
||||
.push(if !valid || !network_valid {
|
||||
button::primary(None, "Next").width(Length::Fixed(200.0))
|
||||
} else {
|
||||
button::primary(None, "Next")
|
||||
|
||||
@ -10,6 +10,7 @@ pub struct Collapse<'a, M, H, F, C> {
|
||||
after: F,
|
||||
content: C,
|
||||
phantom: PhantomData<&'a M>,
|
||||
state: bool,
|
||||
}
|
||||
|
||||
impl<'a, Message, T, H, F, C, Theme, Renderer> Collapse<'a, Message, H, F, C>
|
||||
@ -28,8 +29,14 @@ where
|
||||
after,
|
||||
content,
|
||||
phantom: PhantomData,
|
||||
state: false,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn collapsed(mut self, state: bool) -> Self {
|
||||
self.state = state;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
@ -51,18 +58,18 @@ where
|
||||
type State = bool;
|
||||
type Event = Event<T>;
|
||||
|
||||
fn update(&mut self, state: &mut Self::State, event: Event<T>) -> Option<Message> {
|
||||
fn update(&mut self, _state: &mut Self::State, event: Event<T>) -> Option<Message> {
|
||||
match event {
|
||||
Event::Internal(e) => Some(e.into()),
|
||||
Event::Collapse(s) => {
|
||||
*state = s;
|
||||
self.state = s;
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn view(&self, state: &Self::State) -> Element<Self::Event, Theme, Renderer> {
|
||||
if *state {
|
||||
fn view(&self, _state: &Self::State) -> Element<Self::Event, Theme, Renderer> {
|
||||
if self.state {
|
||||
column![
|
||||
(self.after)().on_press(Event::Collapse(false)),
|
||||
(self.content)().map(Event::Internal)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user