From 8a8addfac36c3bb27528bc98a70ab0dcd9574b1d Mon Sep 17 00:00:00 2001 From: nn2-minh <Nguyen12.Minh@live.uwe.ac.uk> Date: Mon, 14 Apr 2025 16:27:44 +0700 Subject: [PATCH] add refresh page button for dashboard --- app/frontend/components/dashboard.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/app/frontend/components/dashboard.py b/app/frontend/components/dashboard.py index 180c49b..a2748ab 100644 --- a/app/frontend/components/dashboard.py +++ b/app/frontend/components/dashboard.py @@ -127,7 +127,30 @@ def dashboard_frame(parent, switch_func, API_URL, token): height=35, command=perform_search, ) - search_button.pack(side="right", padx=20) + search_button.pack(side="right", padx=(0, 20)) + + # Add refresh button with improved design + def refresh_dashboard(): + """Refresh the dashboard to its initial state""" + # Clear search entry + search_entry.delete(0, "end") + # Reload featured shops and recommendations + fetch_featured_shops() + fetch_recommendations() + + refresh_button = ctk.CTkButton( + search_frame, + text="⟳", # Unicode refresh symbol + fg_color="#3b3b3b", # Dark background + text_color="white", + width=35, + height=35, + corner_radius=20, # Make it circular + hover_color=SHOPPING, # Use shopping color on hover + font=("Helvetica", 20), # Larger font for the icon + command=refresh_dashboard, + ) + refresh_button.pack(side="right", padx=(0, 10)) # Featured Shops Carousel carousel_frame = ctk.CTkFrame(main_content, fg_color=CARD_BG, height=300) -- GitLab