Skip to content

Commit

Permalink
feat: warn user in XvB tab if no address is set in P2pool Tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrix126 committed Mar 13, 2024
1 parent 340ee45 commit f2d0c9a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/panels/middle/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ path_xmr: {:#?}\n
}
Tab::Xvb => {
debug!("App | Entering [XvB] Tab");
crate::disk::state::Xvb::show(&mut self.state.xvb, self.size, ctx, ui, &self.xvb_api);
crate::disk::state::Xvb::show(&mut self.state.xvb, self.size, &self.state.p2pool.address, ctx, ui, &self.xvb_api);
}
}
});
Expand Down
19 changes: 15 additions & 4 deletions src/app/panels/middle/xvb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use egui::{Hyperlink, Image, Label, RichText, TextEdit, Vec2};
use log::debug;

use crate::helper::xvb::PubXvbApi;
use crate::utils::constants::{GREEN, LIGHT_GRAY, RED, XVB_HELP, XVB_TOKEN_LEN};
use crate::utils::constants::{GREEN, LIGHT_GRAY, ORANGE, RED, XVB_HELP, XVB_TOKEN_LEN};
use crate::utils::macros::lock;
use crate::utils::regex::Regexes;
use crate::{
constants::{BYTES_XVB, SPACE},
utils::constants::{DARK_GRAY, XVB_URL},
Expand All @@ -17,6 +18,7 @@ impl crate::disk::state::Xvb {
pub fn show(
&mut self,
size: Vec2,
address: &str,
_ctx: &egui::Context,
ui: &mut egui::Ui,
api: &Arc<Mutex<PubXvbApi>>,
Expand Down Expand Up @@ -82,11 +84,20 @@ impl crate::disk::state::Xvb {
ui.add_sized(
[width / 8.0, text_edit],
TextEdit::singleline(&mut self.token),
)
.on_hover_text_at_pointer(XVB_HELP);
);

ui.add(Label::new(RichText::new(text_check).color(color)))
});
});
})
.response
.on_hover_text_at_pointer(XVB_HELP);
// need to warn the user if no address is set in p2pool tab
if !Regexes::addr_ok(address) {
debug!("XvB Tab | Rendering warning text");
ui.label(RichText::new("You don't have any payout address set in the P2pool Tab !\nXvB process needs one to function properly.")
.color(ORANGE));
}
// hero option
// private stats
}
}

0 comments on commit f2d0c9a

Please sign in to comment.