Prechádzať zdrojové kódy

Add inline loading overlay to email writer output panel.

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

+ 22 - 6
gramora/Views/EmailWriterView.swift

@@ -218,16 +218,14 @@ struct EmailWriterView: View {
                 ToolbarButton(title: "Copy Email", iconName: "doc.on.doc") {
                     viewModel.copyGeneratedEmail()
                 }
-                .disabled(!viewModel.canCopy)
-                .opacity(viewModel.canCopy ? 1 : 0.55)
+                .disabled(!viewModel.canCopy || viewModel.isGenerating)
+                .opacity(viewModel.canCopy && !viewModel.isGenerating ? 1 : 0.55)
             }
 
-            ZStack(alignment: .topLeading) {
+            ZStack {
                 ThinCaretTextEditor(
                     text: $viewModel.generatedEmail,
-                    placeholder: viewModel.isGenerating
-                        ? "Writing your email..."
-                        : "Your generated email will appear here...",
+                    placeholder: "Your generated email will appear here...",
                     isEditable: false
                 )
                 .font(.system(size: 14))
@@ -240,6 +238,24 @@ struct EmailWriterView: View {
                     RoundedRectangle(cornerRadius: AppTheme.inputCornerRadius)
                         .stroke(AppTheme.inputBorder, lineWidth: 1)
                 )
+
+                if viewModel.isGenerating {
+                    VStack(spacing: 12) {
+                        ProgressView()
+                            .controlSize(.regular)
+
+                        Text("Loading...")
+                            .font(.system(size: 16, weight: .semibold))
+                            .foregroundStyle(AppTheme.textPrimary)
+
+                        Text("Writing your email")
+                            .font(.system(size: 14))
+                            .foregroundStyle(AppTheme.textSecondary)
+                    }
+                    .frame(maxWidth: .infinity, maxHeight: .infinity)
+                    .background(Color.white.opacity(0.92))
+                    .clipShape(RoundedRectangle(cornerRadius: AppTheme.inputCornerRadius))
+                }
             }
             .frame(maxHeight: .infinity)
         }