-
Notifications
You must be signed in to change notification settings - Fork 13
feat: dpns subscreens #18
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,57 @@ | ||||||||||||||||||||||||||||||||
| use crate::ui::dpns_contested_names_screen::DPNSSubscreen; | ||||||||||||||||||||||||||||||||
| use crate::{app::AppAction, ui::RootScreenType}; | ||||||||||||||||||||||||||||||||
| use egui::{Context, Frame, Margin, SidePanel}; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| pub fn add_dpns_subscreen_chooser_panel(ctx: &Context) -> AppAction { | ||||||||||||||||||||||||||||||||
| let mut action = AppAction::None; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| let subscreens = vec![ | ||||||||||||||||||||||||||||||||
| DPNSSubscreen::Active, | ||||||||||||||||||||||||||||||||
| DPNSSubscreen::Past, | ||||||||||||||||||||||||||||||||
| DPNSSubscreen::Owned, | ||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| SidePanel::left("dpns_subscreen_chooser_panel") | ||||||||||||||||||||||||||||||||
| .default_width(250.0) | ||||||||||||||||||||||||||||||||
| .frame( | ||||||||||||||||||||||||||||||||
| Frame::none() | ||||||||||||||||||||||||||||||||
| .fill(ctx.style().visuals.panel_fill) | ||||||||||||||||||||||||||||||||
| .inner_margin(Margin::same(10.0)), | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
|
Comment on lines
+14
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider adding accessibility attributes to the panel. While the panel setup is well-structured, consider adding accessibility attributes such as ARIA labels to improve screen reader support. SidePanel::left("dpns_subscreen_chooser_panel")
.default_width(250.0)
+ .id(egui::Id::new("dpns_navigation_panel"))
.frame(
Frame::none()
.fill(ctx.style().visuals.panel_fill)
.inner_margin(Margin::same(10.0)),
)📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||
| .show(ctx, |ui| { | ||||||||||||||||||||||||||||||||
| // Display subscreen names | ||||||||||||||||||||||||||||||||
| ui.vertical(|ui| { | ||||||||||||||||||||||||||||||||
| ui.label("DPNS Subscreens"); | ||||||||||||||||||||||||||||||||
| ui.add_space(10.0); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| for subscreen in subscreens { | ||||||||||||||||||||||||||||||||
| // Show the subscreen name as a clickable option | ||||||||||||||||||||||||||||||||
| if ui.button(subscreen.display_name()).clicked() { | ||||||||||||||||||||||||||||||||
| // Handle navigation based on which subscreen is selected | ||||||||||||||||||||||||||||||||
| match subscreen { | ||||||||||||||||||||||||||||||||
| DPNSSubscreen::Active => { | ||||||||||||||||||||||||||||||||
| action = AppAction::SetMainScreen( | ||||||||||||||||||||||||||||||||
| RootScreenType::RootScreenDPNSActiveContests, | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| DPNSSubscreen::Past => { | ||||||||||||||||||||||||||||||||
| action = AppAction::SetMainScreen( | ||||||||||||||||||||||||||||||||
| RootScreenType::RootScreenDPNSPastContests, | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| DPNSSubscreen::Owned => { | ||||||||||||||||||||||||||||||||
| action = AppAction::SetMainScreen( | ||||||||||||||||||||||||||||||||
| RootScreenType::RootScreenDPNSOwnedNames, | ||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| _ => {} | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| ui.add_space(5.0); | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+52
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance user experience with tooltips and keyboard navigation. Consider adding tooltips and improving keyboard navigation for better user experience. for subscreen in subscreens {
- if ui.button(subscreen.display_name()).clicked() {
+ let button = egui::Button::new(subscreen.display_name())
+ .shortcut_text(format!("Alt+{}", (subscreen as u8 + 1)))
+ .wrap(false);
+ if ui.add(button)
+ .on_hover_text(format!("View {}", subscreen.display_name().to_lowercase()))
+ .clicked() {
match subscreen {
// ... existing match arms ...
}
}
|
||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| action | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| pub mod contract_chooser_panel; | ||
| pub mod dpns_subscreen_chooser_panel; | ||
| pub mod entropy_grid; | ||
| pub mod left_panel; | ||
| pub mod top_panel; |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider extracting DPNS screen initialization logic
While the initialization is correct, consider extracting this into a helper method to reduce code duplication and improve maintainability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@QuantumExplorer, understood.
(_/)
( •_• )