Ver código fonte

Fix Spelling Checker top alignment and results back navigation.

Keep the input screen top-aligned like Email Writer, show back only on results, and return to the checker input instead of leaving the tool.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 mês atrás
pai
commit
a4b42d6a43

+ 1 - 3
gramora/Views/MainView.swift

@@ -65,9 +65,7 @@ struct MainView: View {
         case .aiEmailWriter:
             EmailWriterView()
         case .spellingChecker:
-            SpellCheckerView {
-                viewModel.selectedDestination = .grammarChecker
-            }
+            SpellCheckerView()
         default:
             PlaceholderView(destination: viewModel.selectedDestination)
         }

+ 7 - 6
gramora/Views/SpellCheckerView.swift

@@ -2,15 +2,14 @@ import SwiftUI
 
 struct SpellCheckerView: View {
     @StateObject private var viewModel = SpellCheckerViewModel()
-    let onBackTapped: () -> Void
 
     private let panelBackground = Color(red: 0.96, green: 0.97, blue: 0.98)
 
     var body: some View {
         GeometryReader { proxy in
             let dynamicHorizontalPadding = min(max(proxy.size.width * 0.045, AppTheme.contentPadding), 52)
-            let dynamicTopPadding = min(max(proxy.size.height * 0.05, 24), 44)
-            let dynamicBottomPadding = min(max(proxy.size.height * 0.06, 28), 56)
+            let dynamicTopPadding = min(max(proxy.size.height * 0.015, 8), 16)
+            let dynamicBottomPadding = min(max(proxy.size.height * 0.04, 20), 40)
             let dynamicEditorHeight = min(max(proxy.size.height * 0.43, 260), 560)
 
             Group {
@@ -61,10 +60,12 @@ struct SpellCheckerView: View {
 
     private var header: some View {
         VStack(alignment: .leading, spacing: 16) {
-            IconButton(iconName: "arrow.left") {
-                onBackTapped()
+            if viewModel.hasResults {
+                IconButton(iconName: "arrow.left") {
+                    viewModel.resetResults()
+                }
+                .accessibilityLabel("Go back")
             }
-            .accessibilityLabel("Go back")
 
             HStack(alignment: .top) {
                 VStack(alignment: .leading, spacing: 8) {