Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: refresh on click contested names #39

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/ui/dpns_contested_names_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ impl DPNSContestedNamesScreen {
}
}

fn render_no_active_contests_or_owned_names(&mut self, ui: &mut Ui) {
fn render_no_active_contests_or_owned_names(&mut self, ui: &mut Ui) -> AppAction {
let mut app_action = AppAction::None;
ui.vertical_centered(|ui| {
ui.add_space(20.0); // Add some space to separate from the top
match self.dpns_subscreen {
Expand Down Expand Up @@ -232,9 +233,12 @@ impl DPNSContestedNamesScreen {
ui.label("Please check back later or try refreshing the list.");
ui.add_space(20.0);
if ui.button("Refresh").clicked() {
self.refresh(); // Call refresh logic when the user clicks "Refresh"
app_action |= AppAction::BackendTask(BackendTask::ContestedResourceTask(
ContestedResourceTask::QueryDPNSContestedResources
));
}
});
app_action
}

fn render_table_active_contests(&mut self, ui: &mut Ui) {
Expand Down Expand Up @@ -852,21 +856,21 @@ impl ScreenLike for DPNSContestedNamesScreen {
if has_contested_names {
self.render_table_active_contests(ui);
} else {
self.render_no_active_contests_or_owned_names(ui);
action |= self.render_no_active_contests_or_owned_names(ui);
}
}
DPNSSubscreen::Past => {
if has_contested_names {
self.render_table_past_contests(ui);
} else {
self.render_no_active_contests_or_owned_names(ui);
action |= self.render_no_active_contests_or_owned_names(ui);
}
}
DPNSSubscreen::Owned => {
if !self.local_dpns_names.is_empty() {
self.render_table_local_dpns_names(ui);
} else {
self.render_no_active_contests_or_owned_names(ui);
action |= self.render_no_active_contests_or_owned_names(ui);
}
}
}
Expand Down