fix: impl Display for ManualDonationLevel

This commit is contained in:
mostafaei2002 2024-06-12 19:03:25 +03:30
parent b8cd36eeb2
commit 5cd0acd842
2 changed files with 22 additions and 6 deletions

View file

@ -151,7 +151,6 @@ impl crate::disk::state::Xvb {
ui.group(|ui| {
ui.vertical_centered(|ui| {
ui.horizontal(|ui| {
egui::ComboBox::from_label("")
.selected_text(self.mode.to_string())
.show_ui(ui, |ui| {
@ -221,13 +220,17 @@ impl crate::disk::state::Xvb {
}
if self.mode == XvbMode::ManualDonationLevel {
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::Donor, "Donor")
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::Donor,
ManualDonationLevel::Donor.to_string())
.on_hover_text(XVB_DONATION_LEVEL_DONOR_HELP);
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorVIP, "Donor VIP")
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorVIP,
ManualDonationLevel::DonorVIP.to_string())
.on_hover_text(XVB_DONATION_LEVEL_VIP_DONOR_HELP);
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorWhale, "Donor Whale")
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorWhale,
ManualDonationLevel::DonorWhale.to_string())
.on_hover_text(XVB_DONATION_LEVEL_WHALE_DONOR_HELP);
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorMega, "Donor Mega")
ui.radio_value(&mut self.manual_donation_level, ManualDonationLevel::DonorMega,
ManualDonationLevel::DonorMega.to_string())
.on_hover_text(XVB_DONATION_LEVEL_MEGA_DONOR_HELP);
lock!(api).stats_priv.runtime_manual_donation_level = self.manual_donation_level.clone().into();

View file

@ -272,7 +272,7 @@ impl Display for XvbMode {
Self::Hero => "Hero",
Self::ManualXvb => "Manual Xvb",
Self::ManualP2pool => "Manual P2pool",
Self::ManualDonationLevel => "Manual Donation Level"
Self::ManualDonationLevel => "Manual Donation Level",
};
write!(f, "{}", text)
@ -288,6 +288,19 @@ pub enum ManualDonationLevel {
DonorMega,
}
impl Display for ManualDonationLevel {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let text = match self {
Self::Donor => "Donor",
Self::DonorVIP => "Donor VIP",
Self::DonorWhale => "Donor Whale",
Self::DonorMega => "Donor Mega",
};
write!(f, "{}", text)
}
}
#[derive(Clone, Eq, PartialEq, Debug, Deserialize, Serialize, Default)]
pub enum ManualDonationMetric {
#[default]