06/22 Fix Medium impact items
This commit is contained in:
@@ -23,12 +23,13 @@ struct ExecuteInspectionView: View {
|
||||
let inspection: LocalInspection
|
||||
|
||||
@State private var formValues: [String: String] = [:]
|
||||
@State private var showFlagIssue = false
|
||||
@State private var showSubmitAlert = false
|
||||
@State private var showNoGPSAlert = false
|
||||
@State private var showFlagIssue = false
|
||||
@State private var showSubmitAlert = false
|
||||
@State private var showNoGPSAlert = false
|
||||
@State private var showValidationAlert = false
|
||||
@State private var missingFields: [String] = []
|
||||
@State private var isSaving = false
|
||||
@State private var isSaving = false
|
||||
@State private var autoSavedAt: Date? = nil // drives the auto-save toast
|
||||
@State private var isSubmitting = false
|
||||
@State private var submitResult: SubmitResult?
|
||||
|
||||
@@ -100,6 +101,10 @@ struct ExecuteInspectionView: View {
|
||||
while !Task.isCancelled {
|
||||
try? await Task.sleep(for: .seconds(autoSaveInterval))
|
||||
saveDraft()
|
||||
// Show "Draft saved" toast and dismiss after 2 seconds
|
||||
withAnimation { autoSavedAt = Date() }
|
||||
try? await Task.sleep(for: .seconds(2))
|
||||
withAnimation { autoSavedAt = nil }
|
||||
}
|
||||
}
|
||||
.sheet(isPresented: $showFlagIssue) {
|
||||
@@ -149,7 +154,25 @@ struct ExecuteInspectionView: View {
|
||||
.zIndex(10)
|
||||
}
|
||||
}
|
||||
// Auto-save toast — bottom of screen, fades out after 2 seconds
|
||||
.overlay(alignment: .bottom) {
|
||||
if autoSavedAt != nil {
|
||||
HStack(spacing: 6) {
|
||||
Image(systemName: "checkmark.circle.fill")
|
||||
.foregroundStyle(.green)
|
||||
Text("Draft saved")
|
||||
.font(.subheadline.bold())
|
||||
}
|
||||
.padding(.horizontal, 16).padding(.vertical, 10)
|
||||
.background(.regularMaterial, in: Capsule())
|
||||
.shadow(color: .black.opacity(0.12), radius: 6, y: 2)
|
||||
.padding(.bottom, 24)
|
||||
.transition(.move(edge: .bottom).combined(with: .opacity))
|
||||
.zIndex(9)
|
||||
}
|
||||
}
|
||||
.animation(.spring(duration: 0.35), value: submitResult != nil)
|
||||
.animation(.easeInOut(duration: 0.25), value: autoSavedAt)
|
||||
}
|
||||
|
||||
// ── Form Content ──────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user