Przeglądaj źródła

Dismiss settings when navigating to another page from the sidebar.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 miesiąc temu
rodzic
commit
639e7b7be5

+ 1 - 0
gramora/ViewModels/MainViewModel.swift

@@ -27,6 +27,7 @@ final class MainViewModel: ObservableObject {
     func openHistoryEntry(_ entry: HistoryEntry) {
         pendingHistoryEntry = entry
         selectedDestination = entry.tool.navigationDestination
+        hideSettings()
     }
 
     func clearPendingHistoryEntry() {

+ 7 - 1
gramora/Views/MainView.swift

@@ -13,7 +13,13 @@ struct MainView: View {
             } else {
                 HStack(spacing: 0) {
                     SidebarView(
-                        selectedDestination: $viewModel.selectedDestination,
+                        selectedDestination: Binding(
+                            get: { viewModel.selectedDestination },
+                            set: { destination in
+                                viewModel.selectedDestination = destination
+                                viewModel.hideSettings()
+                            }
+                        ),
                         isPremium: subscriptions.hasPremiumAccess,
                         onUpgradeTapped: viewModel.showPaywall,
                         onManageSubscriptionTapped: viewModel.showPaywall