gui: disable replacement fee input if tx is already replaced
This commit is contained in:
parent
4de0d7bd29
commit
ad2c096715
@ -257,13 +257,17 @@ pub fn create_rbf_modal<'a>(
|
||||
.push(Container::new(p1_bold("Feerate")).padding(10))
|
||||
.spacing(10)
|
||||
.push(
|
||||
form::Form::new_trimmed("", feerate, move |msg| {
|
||||
Message::CreateRbf(CreateRbfMessage::FeerateEdited(msg))
|
||||
})
|
||||
.warning(
|
||||
"Feerate must be greater than previous value and \
|
||||
less than or equal to 1000 sats/vbyte",
|
||||
)
|
||||
if replacement_txid.is_none() {
|
||||
form::Form::new_trimmed("", feerate, move |msg| {
|
||||
Message::CreateRbf(CreateRbfMessage::FeerateEdited(msg))
|
||||
})
|
||||
.warning(
|
||||
"Feerate must be greater than previous value and \
|
||||
less than or equal to 1000 sats/vbyte",
|
||||
)
|
||||
} else {
|
||||
form::Form::new_disabled("", feerate)
|
||||
}
|
||||
.size(P1_SIZE)
|
||||
.padding(10),
|
||||
)
|
||||
|
||||
@ -46,6 +46,19 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new [`Form`] that has a disabled input.
|
||||
///
|
||||
/// It expects:
|
||||
/// - a placeholder
|
||||
/// - the current value
|
||||
pub fn new_disabled(placeholder: &str, value: &Value<String>) -> Self {
|
||||
Self {
|
||||
input: text_input::TextInput::new(placeholder, &value.value),
|
||||
warning: None,
|
||||
valid: value.valid,
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new [`Form`] that trims input values before applying the `on_change` function.
|
||||
///
|
||||
/// It expects:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user