Extract duplicated inline error/loading patterns from TaskListScreen, MyTasksScreen, BusinessSelectionScreen, AccountScreen, and TaskDetailScreen into shared components under Views/Components/. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
27 lines
654 B
Swift
27 lines
654 B
Swift
import SwiftUI
|
|
|
|
/// Reusable loading state view with a spinner and optional message.
|
|
/// Replaces inline ProgressView() patterns across all screens.
|
|
struct LoadingView: View {
|
|
var message: String?
|
|
|
|
var body: some View {
|
|
VStack(spacing: 12) {
|
|
ProgressView()
|
|
if let message = message {
|
|
Text(message)
|
|
.font(.subheadline)
|
|
.foregroundColor(.secondary)
|
|
}
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
}
|
|
}
|
|
|
|
#Preview("With Message") {
|
|
LoadingView(message: "Loading tasks...")
|
|
}
|
|
|
|
#Preview("No Message") {
|
|
LoadingView()
|
|
}
|