Prechádzať zdrojové kódy

Show full-screen loading state during spelling checks.

Match the updated checker flow by presenting a dedicated loading screen while spelling analysis runs before showing results.

Co-authored-by: Cursor <cursoragent@cursor.com>
AhtashamShahzad1 1 mesiac pred
rodič
commit
c58a255e20
1 zmenil súbory, kde vykonal 31 pridanie a 1 odobranie
  1. 31 1
      gramora/Views/SpellCheckerView.swift

+ 31 - 1
gramora/Views/SpellCheckerView.swift

@@ -19,7 +19,13 @@ struct SpellCheckerView: View {
             let dynamicBottomPadding = min(max(proxy.size.height * 0.04, 20), 40)
 
             Group {
-                if viewModel.hasResults {
+                if viewModel.isChecking {
+                    loadingLayout(
+                        horizontalPadding: dynamicHorizontalPadding,
+                        topPadding: AppTheme.brandLabelTopInset,
+                        bottomPadding: dynamicBottomPadding
+                    )
+                } else if viewModel.hasResults {
                     VStack(alignment: .leading, spacing: 0) {
                         header
                             .padding(.bottom, 20)
@@ -73,6 +79,30 @@ struct SpellCheckerView: View {
         onRestoreHandled()
     }
 
+    private func loadingLayout(
+        horizontalPadding: CGFloat,
+        topPadding: CGFloat,
+        bottomPadding: CGFloat
+    ) -> some View {
+        VStack(spacing: 14) {
+            ProgressView()
+                .controlSize(.regular)
+
+            Text("Loading...")
+                .font(.system(size: 16, weight: .semibold))
+                .foregroundStyle(AppTheme.textPrimary)
+
+            Text("Checking spelling and generating corrections")
+                .font(.system(size: 14))
+                .foregroundStyle(AppTheme.textSecondary)
+        }
+        .frame(maxWidth: 1200, maxHeight: .infinity, alignment: .center)
+        .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .center)
+        .padding(.horizontal, horizontalPadding)
+        .padding(.top, topPadding)
+        .padding(.bottom, bottomPadding)
+    }
+
     private var header: some View {
         VStack(alignment: .leading, spacing: 16) {
             if viewModel.hasResults {