diff --git a/src/app/mod.rs b/src/app/mod.rs index 645cf1b..7fa118f 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -18,6 +18,7 @@ use crate::helper::p2pool::ImgP2pool; use crate::helper::p2pool::PubP2poolApi; use crate::helper::xmrig::ImgXmrig; use crate::helper::xmrig::PubXmrigApi; +use crate::helper::xvb::priv_stats::RuntimeMode; use crate::helper::xvb::PubXvbApi; use crate::helper::Helper; use crate::helper::Process; @@ -527,7 +528,14 @@ impl App { // Set saved Hero mode to runtime. debug!("Setting runtime_mode & runtime_manual_amount"); app.xvb_api.lock().unwrap().stats_priv.runtime_mode = app.state.xvb.mode.clone().into(); - app.xvb_api.lock().unwrap().stats_priv.runtime_manual_amount = app.state.xvb.amount.parse().unwrap(); + app.xvb_api.lock().unwrap().stats_priv.runtime_manual_amount = match app.state.xvb.amount.parse() { + Ok(n) => n, + Err(e) => { + error!("App Init | Failed to parse manual amount: {}", e); + app.xvb_api.lock().unwrap().stats_priv.runtime_mode = RuntimeMode::Auto; + 0 + } + }; // Check if [P2pool.node] exists info!("App Init | Checking if saved remote node still exists..."); diff --git a/src/app/panels/middle/xvb.rs b/src/app/panels/middle/xvb.rs index 6f36c94..b47ca10 100644 --- a/src/app/panels/middle/xvb.rs +++ b/src/app/panels/middle/xvb.rs @@ -16,7 +16,7 @@ use crate::utils::constants::{ }; use crate::utils::macros::lock; use crate::utils::regex::Regexes; -use crate::XVB_MINING_ON_FIELD; +use crate::{XVB_MANUAL_HASHRATE_HELP, XVB_MINING_ON_FIELD}; use crate::{ constants::{BYTES_XVB, SPACE}, utils::constants::{DARK_GRAY, XVB_URL}, @@ -130,7 +130,8 @@ impl crate::disk::state::Xvb { ui.horizontal(|ui| { ui.add( TextEdit::singleline(&mut self.amount) - ) + .vertical_align(egui::Align::Center) + ).on_hover_text(XVB_MANUAL_HASHRATE_HELP) }); } diff --git a/src/utils/constants.rs b/src/utils/constants.rs index 872a459..0e9b362 100644 --- a/src/utils/constants.rs +++ b/src/utils/constants.rs @@ -412,6 +412,7 @@ pub const XMRIG_PATH_EMPTY: &str = "XMRig PATH is empty! To fix: goto the [G // XvB pub const XVB_HELP: &str = "You need to register an account by clicking on the link above to get your token with the same p2pool XMR address you use for payment."; +pub const XVB_MANUAL_HASHRATE_HELP: &str = "Set the hashrate amount to donate or keep manually in H/s"; pub const XVB_URL: &str = "https://xmrvsbeast.com"; pub const XVB_URL_PUBLIC_API: &str = "https://xmrvsbeast.com/p2pool/stats";