From eefe3f031f879c0d8bcbba800ff72747346b7ac4 Mon Sep 17 00:00:00 2001 From: Aditya Aryan Date: Thu, 30 Jul 2026 20:58:28 +0530 Subject: [PATCH 1/2] Add confirmation dialog before resetting dashboard progress Signed-off-by: Aditya Aryan --- src/app.rs | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/app.rs b/src/app.rs index b8e98fc..db75c47 100644 --- a/src/app.rs +++ b/src/app.rs @@ -59,6 +59,7 @@ pub struct VisualizerApp { theme: Theme, colorblind_mode: ColorblindMode, show_settings_modal: bool, + show_reset_confirm_modal: bool, show_unaudited: bool, view_mode: ViewMode, completed_problems: std::collections::HashSet, @@ -136,6 +137,7 @@ impl Default for VisualizerApp { theme: Theme::DarkVSCode, // Default to user's favorite VS Code Dark style! colorblind_mode: ColorblindMode::Off, show_settings_modal: false, + show_reset_confirm_modal: false, show_unaudited: false, // Default: Only show 100% Audited problems in Public Release! view_mode: ViewMode::Visualizer, completed_problems: std::collections::HashSet::new(), @@ -321,6 +323,28 @@ impl VisualizerApp { } } + fn render_reset_confirm_modal(&mut self, ctx: &egui::Context) { + if self.show_reset_confirm_modal { + egui::Window::new("Confirm Reset") + .collapsible(false) + .resizable(false) + .show(ctx, |ui| { + ui.label("Are you sure you want to reset all completed problem checkmarks?"); + + ui.horizontal(|ui| { + if ui.button("Cancel").clicked() { + self.show_reset_confirm_modal = false; + } + + if ui.button("Confirm Reset").clicked() { + self.completed_problems.clear(); + self.show_reset_confirm_modal = false; + } + }); + }); + } + } + fn recompute_steps(&mut self) { let app_id = self.selected_approach_id; self.steps = match self.current_problem { @@ -1285,7 +1309,7 @@ impl VisualizerApp { .button(RichText::new("Reset All Progress").strong().color(p.red)) .clicked() { - self.completed_problems.clear(); + self.show_reset_confirm_modal = true; } ui.add_space(12.0); @@ -1455,6 +1479,9 @@ impl VisualizerApp { self.select_problem(prob); self.view_mode = ViewMode::Visualizer; } + + // Render the confirmation dialog on top of the dashboard + self.render_reset_confirm_modal(ctx); } } @@ -2995,6 +3022,7 @@ impl eframe::App for VisualizerApp { }); } }); + self.render_reset_confirm_modal(ctx); } } From 5f4c1d59d3d6323e3cceddcc4ffb0666df423a81 Mon Sep 17 00:00:00 2001 From: Aditya Aryan Date: Fri, 31 Jul 2026 00:44:56 +0530 Subject: [PATCH 2/2] Address review feedback for reset confirmation dialog --- src/app.rs | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/src/app.rs b/src/app.rs index e6084cc..0b22203 100644 --- a/src/app.rs +++ b/src/app.rs @@ -324,25 +324,37 @@ impl VisualizerApp { } fn render_reset_confirm_modal(&mut self, ctx: &egui::Context) { - if self.show_reset_confirm_modal { - egui::Window::new("Confirm Reset") - .collapsible(false) - .resizable(false) - .show(ctx, |ui| { - ui.label("Are you sure you want to reset all completed problem checkmarks?"); + if !self.show_reset_confirm_modal { + return; + } - ui.horizontal(|ui| { - if ui.button("Cancel").clicked() { - self.show_reset_confirm_modal = false; - } + egui::Window::new("Confirm Reset") + .collapsible(false) + .resizable(false) + .anchor(egui::Align2::CENTER_CENTER, [0.0, 0.0]) + .show(ctx, |ui| { + ui.label("Are you sure you want to reset all completed problem checkmarks?"); + ui.add_space(8.0); - if ui.button("Confirm Reset").clicked() { - self.completed_problems.clear(); - self.show_reset_confirm_modal = false; - } - }); + ui.horizontal(|ui| { + if ui.button("Cancel").clicked() { + self.show_reset_confirm_modal = false; + } + + let dark_red = Color32::from_rgb(210, 40, 65); + let confirm_btn = egui::Button::new( + RichText::new("Confirm Reset") + .color(Color32::WHITE) + .strong(), + ) + .fill(dark_red); + + if ui.add(confirm_btn).clicked() { + self.completed_problems.clear(); + self.show_reset_confirm_modal = false; + } }); - } + }); } fn recompute_steps(&mut self) { @@ -3027,7 +3039,6 @@ impl eframe::App for VisualizerApp { }); } }); - self.render_reset_confirm_modal(ctx); } }