convert all primary button to secondary button

This commit is contained in:
edouardparis 2024-10-14 11:24:43 +02:00
parent 8fb74d1cf9
commit 277945dddf
15 changed files with 86 additions and 82 deletions

View File

@ -279,7 +279,7 @@ fn coin_list_view<'a>(
} else {
Column::new().push(
Row::new().push(Space::with_width(Length::Fill)).push(
button::primary(Some(icon::arrow_repeat()), "Refresh coin")
button::secondary(Some(icon::arrow_repeat()), "Refresh coin")
.on_press(Message::Menu(Menu::RefreshCoins(vec![
coin.outpoint,
]))),

View File

@ -87,9 +87,10 @@ pub fn home_view<'a>(
.width(Length::Fill),
)
.push(
button::primary(Some(icon::arrow_repeat()), "Refresh coins").on_press(
Message::Menu(Menu::RefreshCoins(expiring_coins.to_owned())),
),
button::secondary(Some(icon::arrow_repeat()), "Refresh coins")
.on_press(Message::Menu(Menu::RefreshCoins(
expiring_coins.to_owned(),
))),
),
)
.padding(25)
@ -322,7 +323,7 @@ pub fn payment_view<'a>(
.spacing(5),
))
.push(
button::primary(None, "See transaction details")
button::secondary(None, "See transaction details")
.on_press(Message::Menu(Menu::TransactionPreSelected(tx.tx.txid()))),
)
.spacing(20),

View File

@ -20,7 +20,7 @@ pub fn label_editable(
iced::widget::Text::new(label)
.size(size)
.shaping(Shaping::Advanced),
button::primary(Some(icon::pencil_icon()), "Edit").on_press(
button::secondary(Some(icon::pencil_icon()), "Edit").on_press(
view::Message::Label(
labelled,
view::message::LabelMessage::Edited(label.to_string())
@ -34,7 +34,7 @@ pub fn label_editable(
}
}
Container::new(
button::primary(Some(icon::pencil_icon()), "Add label").on_press(view::Message::Label(
button::secondary(Some(icon::pencil_icon()), "Add label").on_press(view::Message::Label(
labelled,
view::message::LabelMessage::Edited(String::default()),
)),
@ -54,11 +54,11 @@ pub fn label_editing(
.size(size)
.padding(10),
if label.valid {
button::primary(None, "Save").on_press(view::message::LabelMessage::Confirm)
button::secondary(None, "Save").on_press(view::message::LabelMessage::Confirm)
} else {
button::primary(None, "Save")
button::secondary(None, "Save")
},
button::primary(None, "Cancel").on_press(view::message::LabelMessage::Cancel)
button::secondary(None, "Cancel").on_press(view::message::LabelMessage::Cancel)
)
.spacing(5)
.align_items(Alignment::Center),

View File

@ -226,7 +226,7 @@ pub fn modal<'a, T: Into<Element<'a, Message>>, F: Into<Element<'a, Message>>>(
Column::new().width(Length::Fill)
})
.align_items(iced::Alignment::Center)
.push(button::primary(Some(cross_icon()), "Close").on_press(Message::Close)),
.push(button::secondary(Some(cross_icon()), "Close").on_press(Message::Close)),
)
.padding(10)
.style(theme::Container::Background),

View File

@ -129,7 +129,7 @@ pub fn save_action<'a>(warning: Option<&Error>, saved: bool) -> Element<'a, Mess
.push(Column::new().width(Length::Fill))
.push(button::alert(None, "Ignore").on_press(Message::Close))
.push(
button::primary(None, "Save")
button::secondary(None, "Save")
.on_press(Message::Spend(SpendTxMessage::Confirm)),
),
),
@ -213,7 +213,7 @@ pub fn broadcast_action<'a>(
})
.push(
Row::new().push(Column::new().width(Length::Fill)).push(
button::primary(None, "Broadcast")
button::secondary(None, "Broadcast")
.on_press(Message::Spend(SpendTxMessage::Confirm)),
),
),
@ -234,7 +234,7 @@ pub fn delete_action<'a>(warning: Option<&Error>, deleted: bool) -> Element<'a,
.spacing(20)
.align_items(Alignment::Center)
.push(text("Successfully deleted this transaction."))
.push(button::primary(None, "Go back to PSBTs").on_press(Message::Close)),
.push(button::secondary(None, "Go back to PSBTs").on_press(Message::Close)),
)
.align_x(iced::alignment::Horizontal::Center)
.width(Length::Fixed(400.0))
@ -379,13 +379,13 @@ pub fn spend_overview_view<'a>(
.push(Space::with_width(Length::Fill))
.push_maybe(if tx.path_ready().is_none() {
Some(
button::primary(None, "Sign")
button::secondary(None, "Sign")
.on_press(Message::Spend(SpendTxMessage::Sign))
.width(Length::Fixed(150.0)),
)
} else {
Some(
button::primary(None, "Broadcast")
button::secondary(None, "Broadcast")
.on_press(Message::Spend(SpendTxMessage::Broadcast))
.width(Length::Fixed(150.0)),
)
@ -1147,12 +1147,12 @@ pub fn update_spend_view<'a>(
)
.push(Row::new().push(Space::with_width(Length::Fill)).push(
if updated.valid && !updated.value.is_empty() && !processing {
button::primary(None, "Update")
button::secondary(None, "Update")
.on_press(Message::ImportSpend(ImportSpendMessage::Confirm))
} else if processing {
button::primary(None, "Processing...")
button::secondary(None, "Processing...")
} else {
button::primary(None, "Update")
button::secondary(None, "Update")
},
)),
),

View File

@ -35,12 +35,12 @@ pub fn import_psbt_view<'a>(
)
.push(Row::new().push(Space::with_width(Length::Fill)).push(
if imported.valid && !imported.value.is_empty() && !processing {
button::primary(None, "Import")
button::secondary(None, "Import")
.on_press(Message::ImportSpend(ImportSpendMessage::Confirm))
} else if processing {
button::primary(None, "Processing...")
button::secondary(None, "Processing...")
} else {
button::primary(None, "Import")
button::secondary(None, "Import")
},
)),
))
@ -70,7 +70,7 @@ pub fn psbts_view(spend_txs: &[SpendTx]) -> Element<'_, Message> {
.on_press(Message::ImportSpend(ImportSpendMessage::Import)),
)
.push(
button::primary(Some(icon::plus_icon()), "New")
button::secondary(Some(icon::plus_icon()), "New")
.on_press(Message::Menu(Menu::CreateSpendTx)),
),
)

View File

@ -45,7 +45,7 @@ pub fn receive<'a>(
.align_items(Alignment::Center)
.push(Container::new(h3("Receive")).width(Length::Fill))
.push(
button::primary(Some(icon::plus_icon()), "Generate address")
button::secondary(Some(icon::plus_icon()), "Generate address")
.on_press(Message::Next),
),
)
@ -112,12 +112,15 @@ pub fn receive<'a>(
.push(
Row::new()
.push(
button::primary(None, "Verify on hardware device")
.on_press(Message::Select(i)),
button::secondary(
None,
"Verify on hardware device",
)
.on_press(Message::Select(i)),
)
.push(Space::with_width(Length::Fill))
.push(
button::primary(None, "Show QR Code")
button::secondary(None, "Show QR Code")
.on_press(Message::ShowQrCode(i)),
),
)

View File

@ -118,11 +118,11 @@ pub fn recovery<'a>(
&& !address.value.is_empty()
&& selected_path.is_some()
{
button::primary(None, "Next")
button::secondary(None, "Next")
.on_press(Message::Next)
.width(Length::Fixed(200.0))
} else {
button::primary(None, "Next").width(Length::Fixed(200.0))
button::secondary(None, "Next").width(Length::Fixed(200.0))
},
)
.spacing(20)

View File

@ -284,7 +284,7 @@ pub fn remote_backend_section<'a>(
None
})
.push(Space::with_width(Length::Fill))
.push(button::primary(None, "Send invitation").on_press_maybe(
.push(button::secondary(None, "Send invitation").on_press_maybe(
if !processing && email_form.valid {
Some(Message::Settings(
SettingsMessage::RemoteBackendSettings(
@ -413,7 +413,7 @@ pub fn bitcoind_edit<'a>(
);
let mut cancel_button = button::transparent(None, " Cancel ").padding(5);
let mut confirm_button = button::primary(None, " Save ").padding(5);
let mut confirm_button = button::secondary(None, " Save ").padding(5);
if !processing {
cancel_button = cancel_button.on_press(SettingsEditMessage::Cancel);
confirm_button = confirm_button.on_press(SettingsEditMessage::Confirm);
@ -599,7 +599,7 @@ pub fn electrum_edit<'a>(
);
let mut cancel_button = button::transparent(None, " Cancel ").padding(5);
let mut confirm_button = button::primary(None, " Save ").padding(5);
let mut confirm_button = button::secondary(None, " Save ").padding(5);
if !processing {
cancel_button = cancel_button.on_press(SettingsEditMessage::Cancel);
confirm_button = confirm_button.on_press(SettingsEditMessage::Confirm);
@ -843,18 +843,18 @@ pub fn rescan<'a>(
&& is_ok_and(&u32::from_str(&day.value), |&v| v > 0 && v <= 31))
{
Row::new().push(Column::new().width(Length::Fill)).push(
button::primary(None, "Start rescan")
button::secondary(None, "Start rescan")
.on_press(SettingsEditMessage::Confirm)
.width(Length::Shrink),
)
} else if processing {
Row::new().push(Column::new().width(Length::Fill)).push(
button::primary(None, "Starting rescan...")
button::secondary(None, "Starting rescan...")
.width(Length::Shrink),
)
} else {
Row::new().push(Column::new().width(Length::Fill)).push(
button::primary(None, "Start rescan").width(Length::Shrink),
button::secondary(None, "Start rescan").width(Length::Shrink),
)
},
),
@ -929,7 +929,7 @@ pub fn wallet_settings<'a>(
.on_press(Message::Clipboard(descriptor.to_string())),
)
.push(
button::primary(
button::secondary(
Some(icon::chip_icon()),
"Register on hardware device",
)
@ -988,10 +988,10 @@ pub fn wallet_settings<'a>(
None
})
.push(if !processing {
button::primary(None, "Update")
button::secondary(None, "Update")
.on_press(Message::Settings(SettingsMessage::Save))
} else {
button::primary(None, "Updating")
button::secondary(None, "Updating")
}),
)
.spacing(10),

View File

@ -290,7 +290,7 @@ pub fn create_spend_tx<'a>(
.align_items(Alignment::Center)
.push(Space::with_width(Length::Fill))
.push(
button::primary(None, "Clear")
button::secondary(None, "Clear")
.on_press(Message::CreateSpend(CreateSpendMessage::Clear))
.width(Length::Fixed(100.0)),
)
@ -299,11 +299,11 @@ pub fn create_spend_tx<'a>(
&& !duplicate
&& (is_self_send || Some(&Amount::from_sat(0)) == amount_left)
{
button::primary(None, "Next")
button::secondary(None, "Next")
.on_press(Message::CreateSpend(CreateSpendMessage::Generate))
.width(Length::Fixed(100.0))
} else {
button::primary(None, "Next").width(Length::Fixed(100.0))
button::secondary(None, "Next").width(Length::Fixed(100.0))
},
),
)

View File

@ -174,7 +174,7 @@ pub fn create_rbf_modal<'a>(
replacement_txid: Option<Txid>,
warning: Option<&'a Error>,
) -> Element<'a, Message> {
let mut confirm_button = button::primary(None, "Confirm").width(Length::Fixed(200.0));
let mut confirm_button = button::secondary(None, "Confirm").width(Length::Fixed(200.0));
if feerate.valid || is_cancel {
confirm_button =
confirm_button.on_press(Message::CreateRbf(super::CreateRbfMessage::Confirm));
@ -280,7 +280,7 @@ pub fn create_rbf_modal<'a>(
}))
.push_maybe(replacement_txid.map(|id| {
Row::new().push(
button::primary(None, "Go to replacement")
button::secondary(None, "Go to replacement")
.width(Length::Fixed(200.0))
.on_press(Message::Menu(Menu::PsbtPreSelected(id))),
)
@ -360,13 +360,13 @@ pub fn tx_view<'a>(
Some(
Row::new()
.push(
button::primary(None, "Bump fee")
button::secondary(None, "Bump fee")
.width(Length::Fixed(200.0))
.on_press(Message::CreateRbf(super::CreateRbfMessage::New(false))),
)
.push(
tooltip::Tooltip::new(
button::primary(None, "Cancel transaction")
button::secondary(None, "Cancel transaction")
.width(Length::Fixed(200.0))
.on_press(Message::CreateRbf(super::CreateRbfMessage::New(true))),
"Best effort attempt at double spending an unconfirmed outgoing transaction",

View File

@ -223,9 +223,9 @@ pub fn define_descriptor<'a>(
.width(Length::Fixed(200.0)),
)
.push(if !valid {
button::primary(None, "Next").width(Length::Fixed(200.0))
button::secondary(None, "Next").width(Length::Fixed(200.0))
} else {
button::primary(None, "Next")
button::secondary(None, "Next")
.width(Length::Fixed(200.0))
.on_press(Message::Next)
}),
@ -359,7 +359,7 @@ pub fn import_wallet_or_descriptor<'a>(
)
.push(
Row::new().push(Space::with_width(Length::Fill)).push(
button::primary(None, "Accept")
button::secondary(None, "Accept")
.width(Length::Fixed(200.0))
.on_press(Message::ImportRemoteWallet(
message::ImportRemoteWallet::AcceptInvitation,
@ -392,7 +392,7 @@ pub fn import_wallet_or_descriptor<'a>(
)
.push(
Row::new().push(Space::with_width(Length::Fill)).push(
button::primary(None, "Next")
button::secondary(None, "Next")
.width(Length::Fixed(200.0))
.on_press_maybe(if !invitation.value.is_empty() {
Some(Message::ImportRemoteWallet(
@ -462,7 +462,7 @@ pub fn import_wallet_or_descriptor<'a>(
)
.push(
Row::new().push(Space::with_width(Length::Fill)).push(
button::primary(None, "Next")
button::secondary(None, "Next")
.width(Length::Fixed(200.0))
.on_press_maybe(
if imported_descriptor.value.is_empty()
@ -536,9 +536,9 @@ pub fn import_descriptor<'a>(
)))
.push(
if imported_descriptor.value.is_empty() || !imported_descriptor.valid {
button::primary(None, "Next").width(Length::Fixed(200.0))
button::secondary(None, "Next").width(Length::Fixed(200.0))
} else {
button::primary(None, "Next")
button::secondary(None, "Next")
.width(Length::Fixed(200.0))
.on_press(Message::Next)
},
@ -908,11 +908,11 @@ pub fn register_descriptor<'a>(
done,
).on_toggle(Message::UserActionDone)))
.push(if !created_desc || (done && !processing) {
button::primary(None, "Next")
button::secondary(None, "Next")
.on_press(Message::Next)
.width(Length::Fixed(200.0))
} else {
button::primary(None, "Next").width(Length::Fixed(200.0))
button::secondary(None, "Next").width(Length::Fixed(200.0))
})
.spacing(50),
true,
@ -999,11 +999,11 @@ pub fn backup_descriptor<'a>(
checkbox("I have backed up my descriptor", done).on_toggle(Message::UserActionDone),
)
.push(if done {
button::primary(None, "Next")
button::secondary(None, "Next")
.on_press(Message::Next)
.width(Length::Fixed(200.0))
} else {
button::primary(None, "Next").width(Length::Fixed(200.0))
button::secondary(None, "Next").width(Length::Fixed(200.0))
})
.spacing(50),
true,
@ -1244,11 +1244,11 @@ pub fn define_bitcoin_node<'a>(
.width(Length::Fixed(200.0)),
))
.push(if is_running.map(|res| res.is_ok()).unwrap_or(false) {
button::primary(None, "Next")
button::secondary(None, "Next")
.on_press(Message::Next)
.width(Length::Fixed(200.0))
} else {
button::primary(None, "Next").width(Length::Fixed(200.0))
button::secondary(None, "Next").width(Length::Fixed(200.0))
}),
)
.spacing(50);
@ -1475,7 +1475,7 @@ pub fn select_bitcoind_type<'a>(progress: (usize, usize)) -> Element<'a, Message
.width(Length::Fixed(300.0))
.align_items(Alignment::Center)
.push(
button::primary(None, "Select")
button::secondary(None, "Select")
.width(Length::Fixed(300.0))
.on_press(Message::SelectBitcoindType(
message::SelectBitcoindTypeMsg::UseExternal(true),
@ -1491,7 +1491,7 @@ pub fn select_bitcoind_type<'a>(progress: (usize, usize)) -> Element<'a, Message
.width(Length::Fixed(300.0))
.align_items(Alignment::Center)
.push(
button::primary(None, "Select")
button::secondary(None, "Select")
.width(Length::Fixed(300.0))
.on_press(Message::SelectBitcoindType(
message::SelectBitcoindTypeMsg::UseExternal(false),
@ -1515,7 +1515,7 @@ pub fn start_internal_bitcoind<'a>(
install_state: Option<&InstallState>,
) -> Element<'a, Message> {
let version = crate::node::bitcoind::VERSION;
let mut next_button = button::primary(None, "Next").width(Length::Fixed(200.0));
let mut next_button = button::secondary(None, "Next").width(Length::Fixed(200.0));
if let Some(Ok(_)) = started {
next_button = next_button.on_press(Message::Next);
};
@ -1975,7 +1975,7 @@ pub fn edit_key_modal<'a>(
.push(
if form_xpub.valid && !form_xpub.value.is_empty() && !form_name.value.is_empty() && !duplicate_master_fg
{
button::primary(None, "Apply")
button::secondary(None, "Apply")
.on_press(Message::DefineDescriptor(
message::DefineDescriptor::KeyModal(
message::ImportKeyModal::ConfirmXpub,
@ -1983,7 +1983,7 @@ pub fn edit_key_modal<'a>(
))
.width(Length::Fixed(200.0))
} else {
button::primary(None, "Apply").width(Length::Fixed(100.0))
button::secondary(None, "Apply").width(Length::Fixed(100.0))
},
)
.align_items(Alignment::Center),
@ -2069,13 +2069,13 @@ pub fn edit_sequence_modal<'a>(sequence: &form::Value<String>) -> Element<'a, Me
}
card::simple(col.push(if sequence.valid {
button::primary(None, "Apply")
button::secondary(None, "Apply")
.on_press(Message::DefineDescriptor(
message::DefineDescriptor::SequenceModal(message::SequenceModal::ConfirmSequence),
))
.width(Length::Fixed(200.0))
} else {
button::primary(None, "Apply").width(Length::Fixed(200.0))
button::secondary(None, "Apply").width(Length::Fixed(200.0))
}))
.width(Length::Fixed(800.0))
.into()
@ -2226,11 +2226,11 @@ pub fn backup_mnemonic<'a>(
)
.push(checkbox("I have backed up my mnemonic", done).on_toggle(Message::UserActionDone))
.push(if done {
button::primary(None, "Next")
button::secondary(None, "Next")
.on_press(Message::Next)
.width(Length::Fixed(200.0))
} else {
button::primary(None, "Next").width(Length::Fixed(200.0))
button::secondary(None, "Next").width(Length::Fixed(200.0))
})
.spacing(50),
true,
@ -2315,7 +2315,7 @@ pub fn recover_mnemonic<'a>(
.width(Length::Fixed(200.0)),
)
.push(
button::primary(None, "Skip")
button::secondary(None, "Skip")
.on_press(Message::Skip)
.width(Length::Fixed(200.0)),
)
@ -2329,9 +2329,9 @@ pub fn recover_mnemonic<'a>(
)
.push(
if words.iter().any(|(_, valid)| !valid) || error.is_some() {
button::primary(None, "Next").width(Length::Fixed(200.0))
button::secondary(None, "Next").width(Length::Fixed(200.0))
} else {
button::primary(None, "Next")
button::secondary(None, "Next")
.on_press(Message::Next)
.width(Length::Fixed(200.0))
},
@ -2372,7 +2372,7 @@ pub fn choose_backend(progress: (usize, usize)) -> Element<'static, Message> {
.spacing(20)
.push(
Container::new(
button::primary(None, "Select")
button::secondary(None, "Select")
.on_press(Message::SelectBackend(
message::SelectBackend::ContinueWithLocalWallet(true),
))
@ -2382,7 +2382,7 @@ pub fn choose_backend(progress: (usize, usize)) -> Element<'static, Message> {
)
.push(
Container::new(
button::primary(None, "Select")
button::secondary(None, "Select")
.on_press(Message::SelectBackend(
message::SelectBackend::ContinueWithLocalWallet(false),
))
@ -2440,7 +2440,7 @@ pub fn connection_step_enter_email<'a>(
.warning("Email is not valid"),
)
.push(
button::primary(None, "Next")
button::secondary(None, "Next")
.on_press_maybe(if processing || !email.valid {
None
} else {
@ -2476,11 +2476,11 @@ pub fn connection_step_enter_otp<'a>(
Row::new()
.spacing(10)
.push(
button::primary(Some(icon::previous_icon()), "Change Email")
button::secondary(Some(icon::previous_icon()), "Change Email")
.on_press(Message::SelectBackend(message::SelectBackend::EditEmail)),
)
.push(
button::primary(None, "Resend token").on_press_maybe(if processing {
button::secondary(None, "Resend token").on_press_maybe(if processing {
None
} else {
Some(Message::SelectBackend(message::SelectBackend::RequestOTP))
@ -2505,11 +2505,11 @@ pub fn connection_step_connected<'a>(
Row::new()
.spacing(10)
.push(
button::primary(Some(icon::previous_icon()), "Change Email")
button::secondary(Some(icon::previous_icon()), "Change Email")
.on_press(Message::SelectBackend(message::SelectBackend::EditEmail)),
)
.push(
button::primary(None, "Continue").on_press_maybe(if processing {
button::secondary(None, "Continue").on_press_maybe(if processing {
None
} else {
Some(Message::Next)

View File

@ -388,7 +388,7 @@ impl DeleteWalletModal {
Command::none()
}
fn view(&self) -> Element<Message> {
let mut confirm_button = button::primary(None, "Delete wallet")
let mut confirm_button = button::secondary(None, "Delete wallet")
.width(Length::Fixed(200.0))
.style(theme::Button::Destructive);
if self.warning.is_none() {

View File

@ -401,7 +401,7 @@ impl LianaLiteLogin {
.padding(10)
.warning("Email is not valid"),
)
.push(button::primary(None, "Next").on_press_maybe(
.push(button::secondary(None, "Next").on_press_maybe(
if self.processing {
None
} else {
@ -427,14 +427,14 @@ impl LianaLiteLogin {
Row::new()
.spacing(10)
.push(
button::primary(
button::secondary(
Some(icon::previous_icon()),
"Change email",
)
.on_press(ViewMessage::EditEmail),
)
.push(
button::primary(None, "Resend token")
button::secondary(None, "Resend token")
.on_press_maybe(if self.processing {
None
} else {

View File

@ -454,7 +454,7 @@ pub fn view(step: &Step) -> Element<ViewMessage> {
.on_press(ViewMessage::SwitchNetwork),
)
.push(
button::primary(None, "Retry")
button::secondary(None, "Retry")
.width(Length::Fixed(200.0))
.on_press(ViewMessage::Retry),
),