mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2025-01-08 23:19:26 +00:00
feat: add scrollbar to xvb tab
This commit is contained in:
parent
a232058772
commit
089cdf5e17
1 changed files with 277 additions and 273 deletions
|
@ -36,296 +36,300 @@ impl crate::disk::state::Xvb {
|
||||||
gui_api_xmrig: &Arc<Mutex<PubXmrigApi>>,
|
gui_api_xmrig: &Arc<Mutex<PubXmrigApi>>,
|
||||||
private_stats: bool,
|
private_stats: bool,
|
||||||
) {
|
) {
|
||||||
let website_height = size.y / 10.0;
|
egui::ScrollArea::vertical().show(ui, |ui| {
|
||||||
let width = size.x;
|
|
||||||
let height = size.y;
|
|
||||||
let space_h = height / 48.0;
|
|
||||||
|
|
||||||
// logo and website link
|
let website_height = size.y / 10.0;
|
||||||
ui.horizontal(|ui| {
|
let width = size.x;
|
||||||
ui.add_space(width / 2.0 - 150.0);
|
let height = size.y;
|
||||||
ui.add_sized(
|
let space_h = height / 48.0;
|
||||||
[100.0, website_height],
|
|
||||||
Image::from_bytes("bytes:/xvb.png", BYTES_XVB),
|
|
||||||
);
|
|
||||||
ui.style_mut().override_text_style = Some(TextStyle::Heading);
|
|
||||||
ui.add_space(space_h);
|
|
||||||
ui.hyperlink_to("XMRvsBeast", XVB_URL);
|
|
||||||
ui.add_space(space_h);
|
|
||||||
});
|
|
||||||
|
|
||||||
// console output for log
|
// logo and website link
|
||||||
debug!("XvB Tab | Rendering [Console]");
|
ui.horizontal(|ui| {
|
||||||
ui.group(|ui| {
|
ui.add_space(width / 2.0 - 150.0);
|
||||||
let text = &lock!(api).output;
|
ui.add_sized(
|
||||||
let nb_lines = num_lines(text);
|
[100.0, website_height],
|
||||||
let height = size.y / 2.8;
|
Image::from_bytes("bytes:/xvb.png", BYTES_XVB),
|
||||||
let width = size.x - (space_h / 2.0);
|
);
|
||||||
egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| {
|
ui.style_mut().override_text_style = Some(TextStyle::Heading);
|
||||||
ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into()));
|
ui.add_space(space_h);
|
||||||
egui::ScrollArea::vertical()
|
ui.hyperlink_to("XMRvsBeast", XVB_URL);
|
||||||
.stick_to_bottom(true)
|
ui.add_space(space_h);
|
||||||
.max_width(width)
|
});
|
||||||
.max_height(height)
|
|
||||||
.auto_shrink([false; 2])
|
// console output for log
|
||||||
// .show_viewport(ui, |ui, _| {
|
debug!("XvB Tab | Rendering [Console]");
|
||||||
.show_rows(
|
ui.group(|ui| {
|
||||||
ui,
|
let text = &lock!(api).output;
|
||||||
ui.text_style_height(&TextStyle::Name("MonospaceSmall".into())),
|
let nb_lines = num_lines(text);
|
||||||
nb_lines,
|
let height = size.y / 2.8;
|
||||||
|ui, row_range| {
|
let width = size.x - (space_h / 2.0);
|
||||||
for i in row_range {
|
egui::Frame::none().fill(DARK_GRAY).show(ui, |ui| {
|
||||||
if let Some(line) = text.lines().nth(i) {
|
ui.style_mut().override_text_style = Some(Name("MonospaceSmall".into()));
|
||||||
ui.label(line);
|
egui::ScrollArea::vertical()
|
||||||
|
.stick_to_bottom(true)
|
||||||
|
.max_width(width)
|
||||||
|
.max_height(height)
|
||||||
|
.auto_shrink([false; 2])
|
||||||
|
// .show_viewport(ui, |ui, _| {
|
||||||
|
.show_rows(
|
||||||
|
ui,
|
||||||
|
ui.text_style_height(&TextStyle::Name("MonospaceSmall".into())),
|
||||||
|
nb_lines,
|
||||||
|
|ui, row_range| {
|
||||||
|
for i in row_range {
|
||||||
|
if let Some(line) = text.lines().nth(i) {
|
||||||
|
ui.label(line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// input token
|
|
||||||
let len_token = format!("{}", self.token.len());
|
|
||||||
let (text, color) = if self.token.is_empty() {
|
|
||||||
(
|
|
||||||
format!("{} [{}/{}] ➖", XVB_TOKEN_FIELD, len_token, XVB_TOKEN_LEN),
|
|
||||||
LIGHT_GRAY,
|
|
||||||
)
|
|
||||||
} else if self.token.parse::<u32>().is_ok() && self.token.len() < XVB_TOKEN_LEN {
|
|
||||||
(
|
|
||||||
format!("{} [{}/{}]", XVB_TOKEN_FIELD, len_token, XVB_TOKEN_LEN),
|
|
||||||
GREEN,
|
|
||||||
)
|
|
||||||
} else if self.token.parse::<u32>().is_ok() && self.token.len() == XVB_TOKEN_LEN {
|
|
||||||
(format!("{} ✔", XVB_TOKEN_FIELD), GREEN)
|
|
||||||
} else {
|
|
||||||
(
|
|
||||||
format!("{} [{}/{}] ❌", XVB_TOKEN_FIELD, len_token, XVB_TOKEN_LEN),
|
|
||||||
RED,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
ui.add_space(space_h);
|
|
||||||
ui.horizontal(|ui| {
|
|
||||||
// hovering text is difficult because egui doesn't hover over inner widget. But on disabled does.
|
|
||||||
ui.group(|ui| {
|
|
||||||
ui.colored_label(color, text)
|
|
||||||
.on_hover_text(XVB_HELP);
|
|
||||||
ui.add(
|
|
||||||
TextEdit::singleline(&mut self.token)
|
|
||||||
.char_limit(9)
|
|
||||||
.desired_width(ui.text_style_height(&TextStyle::Body) * 9.0)
|
|
||||||
.vertical_align(egui::Align::Center),
|
|
||||||
).on_hover_text(XVB_HELP)
|
|
||||||
});
|
|
||||||
// .on_hover_text(XVB_HELP);
|
|
||||||
ui.add_space(height / 48.0);
|
|
||||||
ui.style_mut().spacing.icon_width_inner = width / 45.0;
|
|
||||||
ui.style_mut().spacing.icon_width = width / 35.0;
|
|
||||||
ui.style_mut().spacing.icon_spacing = space_h;
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------- XVB Simple -------------------------------------------
|
|
||||||
if self.simple {
|
|
||||||
|
|
||||||
if ui.checkbox(&mut self.simple_hero_mode, "Hero Mode").on_hover_text(XVB_HERO_SELECT).clicked() {
|
|
||||||
// also change hero mode of runtime.
|
|
||||||
lock!(api).stats_priv.runtime_mode = RuntimeMode::Hero;
|
|
||||||
} else {
|
|
||||||
lock!(api).stats_priv.runtime_mode = RuntimeMode::Auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
ui.add_space(space_h);
|
|
||||||
|
|
||||||
// --------------------------- XVB Advanced -----------------------------------------
|
|
||||||
if !self.simple {
|
|
||||||
|
|
||||||
ui.group(|ui| {
|
|
||||||
ui.vertical_centered(|ui| {
|
|
||||||
ui.horizontal(|ui| {
|
|
||||||
|
|
||||||
egui::ComboBox::from_label("")
|
|
||||||
.selected_text(format!("{:?}", self.mode))
|
|
||||||
.show_ui(ui, |ui| {
|
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::Auto, "Automatic");
|
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::Hero, "Hero Mode");
|
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::ManuallyDonate, "Manually Donate");
|
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::ManuallyKeep, "Manually Keep");
|
|
||||||
ui.selectable_value(&mut self.mode, XvbMode::ManualDonationLevel, "Manual Donation Level");
|
|
||||||
});
|
|
||||||
if self.mode == XvbMode::ManuallyDonate || self.mode == XvbMode::ManuallyKeep {
|
|
||||||
|
|
||||||
ui.add_space(space_h);
|
|
||||||
|
|
||||||
let hashrate_xmrig = {
|
|
||||||
if lock!(gui_api_xmrig).hashrate_raw_15m > 0.0 {
|
|
||||||
lock!(gui_api_xmrig).hashrate_raw_15m
|
|
||||||
} else if lock!(gui_api_xmrig).hashrate_raw_1m > 0.0 {
|
|
||||||
lock!(gui_api_xmrig).hashrate_raw_1m
|
|
||||||
} else {
|
|
||||||
lock!(gui_api_xmrig).hashrate_raw
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ui.add(
|
|
||||||
egui::Slider::new(&mut self.amount, 0.0..=(hashrate_xmrig as f64)).text("H/s")
|
|
||||||
).on_hover_text(XVB_MANUAL_HASHRATE_HELP);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.mode == XvbMode::ManualDonationLevel {
|
|
||||||
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::VIP, "VIP");
|
|
||||||
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::Donor, "Donor");
|
|
||||||
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorVIP, "DonorVIP");
|
|
||||||
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorWhale, "DonorWhale");
|
|
||||||
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorMega, "DonorMega");
|
|
||||||
|
|
||||||
lock!(api).stats_priv.runtime_manual_donation_level = self.manual_donation_level.clone().into();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
// input token
|
||||||
|
let len_token = format!("{}", self.token.len());
|
||||||
// Set runtime_mode & runtime_manual_amount
|
let (text, color) = if self.token.is_empty() {
|
||||||
lock!(api).stats_priv.runtime_mode = self.mode.clone().into();
|
(
|
||||||
lock!(api).stats_priv.runtime_manual_amount = self.amount;
|
format!("{} [{}/{}] ➖", XVB_TOKEN_FIELD, len_token, XVB_TOKEN_LEN),
|
||||||
}
|
LIGHT_GRAY,
|
||||||
|
)
|
||||||
// need to warn the user if no address is set in p2pool tab
|
} else if self.token.parse::<u32>().is_ok() && self.token.len() < XVB_TOKEN_LEN {
|
||||||
if !Regexes::addr_ok(address) {
|
(
|
||||||
debug!("XvB Tab | Rendering warning text");
|
format!("{} [{}/{}]", XVB_TOKEN_FIELD, len_token, XVB_TOKEN_LEN),
|
||||||
ui.horizontal_wrapped(|ui|{
|
GREEN,
|
||||||
ui.label(RichText::new("You don't have any payout address set in the P2pool Tab ! XvB process needs one to function properly.")
|
)
|
||||||
.color(ORANGE));
|
} else if self.token.parse::<u32>().is_ok() && self.token.len() == XVB_TOKEN_LEN {
|
||||||
|
(format!("{} ✔", XVB_TOKEN_FIELD), GREEN)
|
||||||
});
|
} else {
|
||||||
}
|
(
|
||||||
|
format!("{} [{}/{}] ❌", XVB_TOKEN_FIELD, len_token, XVB_TOKEN_LEN),
|
||||||
// private stats
|
RED,
|
||||||
ui.add_space(space_h);
|
)
|
||||||
// ui.add_enabled_ui(private_stats, |ui| {
|
};
|
||||||
ui.add_enabled_ui(private_stats, |ui| {
|
ui.add_space(space_h);
|
||||||
let api = &lock!(api);
|
|
||||||
let priv_stats = &api.stats_priv;
|
|
||||||
let current_node = &api.current_node;
|
|
||||||
let width_stat = (ui.available_width() - SPACE * 4.0) / 5.0;
|
|
||||||
let height_stat = 0.0;
|
|
||||||
let size_stat = vec2(width_stat, height_stat);
|
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
let round = match &priv_stats.round_participate {
|
// hovering text is difficult because egui doesn't hover over inner widget. But on disabled does.
|
||||||
Some(r) => r.to_string(),
|
|
||||||
None => "None".to_string(),
|
|
||||||
};
|
|
||||||
ui.add_sized(size_stat, |ui: &mut Ui| {
|
|
||||||
ui.group(|ui| {
|
ui.group(|ui| {
|
||||||
let size_stat = vec2(
|
ui.colored_label(color, text)
|
||||||
ui.available_width(),
|
.on_hover_text(XVB_HELP);
|
||||||
0.0, // + ui.spacing().item_spacing.y,
|
ui.add(
|
||||||
);
|
TextEdit::singleline(&mut self.token)
|
||||||
ui.add_sized(size_stat, |ui: &mut Ui| {
|
.char_limit(9)
|
||||||
ui.vertical_centered(|ui| {
|
.desired_width(ui.text_style_height(&TextStyle::Body) * 9.0)
|
||||||
ui.label(XVB_FAILURE_FIELD);
|
.vertical_align(egui::Align::Center),
|
||||||
ui.label(priv_stats.fails.to_string());
|
).on_hover_text(XVB_HELP)
|
||||||
})
|
});
|
||||||
.response
|
// .on_hover_text(XVB_HELP);
|
||||||
|
ui.add_space(height / 48.0);
|
||||||
|
ui.style_mut().spacing.icon_width_inner = width / 45.0;
|
||||||
|
ui.style_mut().spacing.icon_width = width / 35.0;
|
||||||
|
ui.style_mut().spacing.icon_spacing = space_h;
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------- XVB Simple -------------------------------------------
|
||||||
|
if self.simple {
|
||||||
|
|
||||||
|
if ui.checkbox(&mut self.simple_hero_mode, "Hero Mode").on_hover_text(XVB_HERO_SELECT).clicked() {
|
||||||
|
// also change hero mode of runtime.
|
||||||
|
lock!(api).stats_priv.runtime_mode = RuntimeMode::Hero;
|
||||||
|
} else {
|
||||||
|
lock!(api).stats_priv.runtime_mode = RuntimeMode::Auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
ui.add_space(space_h);
|
||||||
|
|
||||||
|
// --------------------------- XVB Advanced -----------------------------------------
|
||||||
|
if !self.simple {
|
||||||
|
|
||||||
|
ui.group(|ui| {
|
||||||
|
ui.vertical_centered(|ui| {
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
|
||||||
|
egui::ComboBox::from_label("")
|
||||||
|
.selected_text(format!("{:?}", self.mode))
|
||||||
|
.show_ui(ui, |ui| {
|
||||||
|
ui.selectable_value(&mut self.mode, XvbMode::Auto, "Automatic");
|
||||||
|
ui.selectable_value(&mut self.mode, XvbMode::Hero, "Hero Mode");
|
||||||
|
ui.selectable_value(&mut self.mode, XvbMode::ManuallyDonate, "Manually Donate");
|
||||||
|
ui.selectable_value(&mut self.mode, XvbMode::ManuallyKeep, "Manually Keep");
|
||||||
|
ui.selectable_value(&mut self.mode, XvbMode::ManualDonationLevel, "Manual Donation Level");
|
||||||
});
|
});
|
||||||
ui.separator();
|
if self.mode == XvbMode::ManuallyDonate || self.mode == XvbMode::ManuallyKeep {
|
||||||
ui.add_sized(size_stat, |ui: &mut Ui| {
|
|
||||||
ui.vertical_centered(|ui| {
|
ui.add_space(space_h);
|
||||||
ui.label(XVB_DONATED_1H_FIELD);
|
|
||||||
ui.label(
|
let hashrate_xmrig = {
|
||||||
[
|
if lock!(gui_api_xmrig).hashrate_raw_15m > 0.0 {
|
||||||
Float::from_3(priv_stats.donor_1hr_avg as f64).to_string(),
|
lock!(gui_api_xmrig).hashrate_raw_15m
|
||||||
" kH/s".to_string(),
|
} else if lock!(gui_api_xmrig).hashrate_raw_1m > 0.0 {
|
||||||
]
|
lock!(gui_api_xmrig).hashrate_raw_1m
|
||||||
.concat(),
|
} else {
|
||||||
);
|
lock!(gui_api_xmrig).hashrate_raw
|
||||||
})
|
}
|
||||||
.response
|
};
|
||||||
});
|
|
||||||
ui.separator();
|
ui.add(
|
||||||
ui.add_sized(size_stat, |ui: &mut Ui| {
|
egui::Slider::new(&mut self.amount, 0.0..=(hashrate_xmrig as f64)).text("H/s")
|
||||||
ui.vertical_centered(|ui| {
|
).on_hover_text(XVB_MANUAL_HASHRATE_HELP);
|
||||||
ui.label(XVB_DONATED_24H_FIELD);
|
|
||||||
ui.label(
|
}
|
||||||
[
|
|
||||||
Float::from_3(priv_stats.donor_24hr_avg as f64).to_string(),
|
if self.mode == XvbMode::ManualDonationLevel {
|
||||||
" kH/s".to_string(),
|
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::VIP, "VIP");
|
||||||
]
|
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::Donor, "Donor");
|
||||||
.concat(),
|
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorVIP, "DonorVIP");
|
||||||
);
|
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorWhale, "DonorWhale");
|
||||||
})
|
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorMega, "DonorMega");
|
||||||
.response
|
|
||||||
});
|
lock!(api).stats_priv.runtime_manual_donation_level = self.manual_donation_level.clone().into();
|
||||||
ui.separator();
|
}
|
||||||
ui.add_enabled_ui(priv_stats.round_participate.is_some(), |ui| {
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set runtime_mode & runtime_manual_amount
|
||||||
|
lock!(api).stats_priv.runtime_mode = self.mode.clone().into();
|
||||||
|
lock!(api).stats_priv.runtime_manual_amount = self.amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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.horizontal_wrapped(|ui|{
|
||||||
|
ui.label(RichText::new("You don't have any payout address set in the P2pool Tab ! XvB process needs one to function properly.")
|
||||||
|
.color(ORANGE));
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// private stats
|
||||||
|
ui.add_space(space_h);
|
||||||
|
// ui.add_enabled_ui(private_stats, |ui| {
|
||||||
|
ui.add_enabled_ui(private_stats, |ui| {
|
||||||
|
let api = &lock!(api);
|
||||||
|
let priv_stats = &api.stats_priv;
|
||||||
|
let current_node = &api.current_node;
|
||||||
|
let width_stat = (ui.available_width() - SPACE * 4.0) / 5.0;
|
||||||
|
let height_stat = 0.0;
|
||||||
|
let size_stat = vec2(width_stat, height_stat);
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
let round = match &priv_stats.round_participate {
|
||||||
|
Some(r) => r.to_string(),
|
||||||
|
None => "None".to_string(),
|
||||||
|
};
|
||||||
|
ui.add_sized(size_stat, |ui: &mut Ui| {
|
||||||
|
ui.group(|ui| {
|
||||||
|
let size_stat = vec2(
|
||||||
|
ui.available_width(),
|
||||||
|
0.0, // + ui.spacing().item_spacing.y,
|
||||||
|
);
|
||||||
ui.add_sized(size_stat, |ui: &mut Ui| {
|
ui.add_sized(size_stat, |ui: &mut Ui| {
|
||||||
ui.vertical_centered(|ui| {
|
ui.vertical_centered(|ui| {
|
||||||
ui.label(XVB_ROUND_TYPE_FIELD);
|
ui.label(XVB_FAILURE_FIELD);
|
||||||
ui.label(round);
|
ui.label(priv_stats.fails.to_string());
|
||||||
|
})
|
||||||
|
.response
|
||||||
|
});
|
||||||
|
ui.separator();
|
||||||
|
ui.add_sized(size_stat, |ui: &mut Ui| {
|
||||||
|
ui.vertical_centered(|ui| {
|
||||||
|
ui.label(XVB_DONATED_1H_FIELD);
|
||||||
|
ui.label(
|
||||||
|
[
|
||||||
|
Float::from_3(priv_stats.donor_1hr_avg as f64).to_string(),
|
||||||
|
" kH/s".to_string(),
|
||||||
|
]
|
||||||
|
.concat(),
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.response
|
||||||
|
});
|
||||||
|
ui.separator();
|
||||||
|
ui.add_sized(size_stat, |ui: &mut Ui| {
|
||||||
|
ui.vertical_centered(|ui| {
|
||||||
|
ui.label(XVB_DONATED_24H_FIELD);
|
||||||
|
ui.label(
|
||||||
|
[
|
||||||
|
Float::from_3(priv_stats.donor_24hr_avg as f64).to_string(),
|
||||||
|
" kH/s".to_string(),
|
||||||
|
]
|
||||||
|
.concat(),
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.response
|
||||||
|
});
|
||||||
|
ui.separator();
|
||||||
|
ui.add_enabled_ui(priv_stats.round_participate.is_some(), |ui| {
|
||||||
|
ui.add_sized(size_stat, |ui: &mut Ui| {
|
||||||
|
ui.vertical_centered(|ui| {
|
||||||
|
ui.label(XVB_ROUND_TYPE_FIELD);
|
||||||
|
ui.label(round);
|
||||||
|
})
|
||||||
|
.response
|
||||||
|
})
|
||||||
|
.on_disabled_hover_text(
|
||||||
|
"You do not yet have a share in the PPLNS Window.",
|
||||||
|
);
|
||||||
|
});
|
||||||
|
ui.separator();
|
||||||
|
ui.add_sized(size_stat, |ui: &mut Ui| {
|
||||||
|
ui.vertical_centered(|ui| {
|
||||||
|
ui.label(XVB_WINNER_FIELD);
|
||||||
|
ui.label(if priv_stats.win_current {
|
||||||
|
"You are Winning the round !"
|
||||||
|
} else {
|
||||||
|
"You are not the winner"
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.response
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.response
|
||||||
|
});
|
||||||
|
});
|
||||||
|
// indicators
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
ui.add_sized(size_stat, |ui: &mut Ui| {
|
||||||
|
ui.group(|ui| {
|
||||||
|
let size_stat = vec2(
|
||||||
|
ui.available_width(),
|
||||||
|
0.0, // + ui.spacing().item_spacing.y,
|
||||||
|
);
|
||||||
|
ui.add_sized(size_stat, |ui: &mut Ui| {
|
||||||
|
ui.vertical_centered(|ui| {
|
||||||
|
ui.label(XVB_MINING_ON_FIELD)
|
||||||
|
.on_hover_text_at_pointer(&priv_stats.msg_indicator);
|
||||||
|
ui.label(
|
||||||
|
current_node
|
||||||
|
.as_ref()
|
||||||
|
.map_or("No where".to_string(), |n| n.to_string()),
|
||||||
|
)
|
||||||
|
.on_hover_text_at_pointer(&priv_stats.msg_indicator);
|
||||||
|
ui.label(Uptime::from(priv_stats.time_switch_node).to_string())
|
||||||
|
.on_hover_text_at_pointer(&priv_stats.msg_indicator)
|
||||||
})
|
})
|
||||||
.response
|
.response
|
||||||
})
|
})
|
||||||
.on_disabled_hover_text(
|
})
|
||||||
"You do not yet have a share in the PPLNS Window.",
|
.response
|
||||||
);
|
.on_disabled_hover_text("Algorithm is not running.")
|
||||||
});
|
|
||||||
ui.separator();
|
|
||||||
ui.add_sized(size_stat, |ui: &mut Ui| {
|
|
||||||
ui.vertical_centered(|ui| {
|
|
||||||
ui.label(XVB_WINNER_FIELD);
|
|
||||||
ui.label(if priv_stats.win_current {
|
|
||||||
"You are Winning the round !"
|
|
||||||
} else {
|
|
||||||
"You are not the winner"
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.response
|
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.response
|
// currently mining on
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// indicators
|
// Rules link help
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal_centered(|ui| {
|
||||||
ui.add_sized(size_stat, |ui: &mut Ui| {
|
// can't have horizontal and vertical centering work together so fix by this.
|
||||||
ui.group(|ui| {
|
ui.add_space((width / 2.0) - (ui.text_style_height(&TextStyle::Heading) * 1.5));
|
||||||
let size_stat = vec2(
|
ui.style_mut().override_text_style = Some(TextStyle::Heading);
|
||||||
ui.available_width(),
|
ui.hyperlink_to("Rules", XVB_URL_RULES)
|
||||||
0.0, // + ui.spacing().item_spacing.y,
|
.on_hover_text("Click here to read the rules and understand how the raffle works.");
|
||||||
);
|
|
||||||
ui.add_sized(size_stat, |ui: &mut Ui| {
|
|
||||||
ui.vertical_centered(|ui| {
|
|
||||||
ui.label(XVB_MINING_ON_FIELD)
|
|
||||||
.on_hover_text_at_pointer(&priv_stats.msg_indicator);
|
|
||||||
ui.label(
|
|
||||||
current_node
|
|
||||||
.as_ref()
|
|
||||||
.map_or("No where".to_string(), |n| n.to_string()),
|
|
||||||
)
|
|
||||||
.on_hover_text_at_pointer(&priv_stats.msg_indicator);
|
|
||||||
ui.label(Uptime::from(priv_stats.time_switch_node).to_string())
|
|
||||||
.on_hover_text_at_pointer(&priv_stats.msg_indicator)
|
|
||||||
})
|
|
||||||
.response
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.response
|
|
||||||
.on_disabled_hover_text("Algorithm is not running.")
|
|
||||||
})
|
|
||||||
// currently mining on
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
// Rules link help
|
|
||||||
ui.horizontal_centered(|ui| {
|
|
||||||
// can't have horizontal and vertical centering work together so fix by this.
|
|
||||||
ui.add_space((width / 2.0) - (ui.text_style_height(&TextStyle::Heading) * 1.5));
|
|
||||||
ui.style_mut().override_text_style = Some(TextStyle::Heading);
|
|
||||||
ui.hyperlink_to("Rules", XVB_URL_RULES)
|
|
||||||
.on_hover_text("Click here to read the rules and understand how the raffle works.");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue