73 lines
1.8 KiB
Swift
73 lines
1.8 KiB
Swift
import SwiftUI
|
|
|
|
struct LoadingView: View {
|
|
var message: String = "Loading..."
|
|
|
|
var body: some View {
|
|
VStack(spacing: 16) {
|
|
ProgressView()
|
|
.controlSize(.large)
|
|
.tint(Color.accentWarm)
|
|
Text(message)
|
|
.font(.subheadline)
|
|
.foregroundStyle(Color.text3)
|
|
}
|
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
.background(Color.canvas)
|
|
}
|
|
}
|
|
|
|
struct ErrorBanner: View {
|
|
let message: String
|
|
var onRetry: (() -> Void)?
|
|
|
|
var body: some View {
|
|
HStack(spacing: 12) {
|
|
Image(systemName: "exclamationmark.triangle.fill")
|
|
.foregroundStyle(Color.error)
|
|
|
|
Text(message)
|
|
.font(.subheadline)
|
|
.foregroundStyle(Color.text2)
|
|
|
|
Spacer()
|
|
|
|
if let onRetry {
|
|
Button("Retry") {
|
|
onRetry()
|
|
}
|
|
.font(.subheadline.weight(.semibold))
|
|
.foregroundStyle(Color.accentWarm)
|
|
}
|
|
}
|
|
.padding(12)
|
|
.background(Color.error.opacity(0.06))
|
|
.clipShape(RoundedRectangle(cornerRadius: 12))
|
|
}
|
|
}
|
|
|
|
struct EmptyStateView: View {
|
|
let icon: String
|
|
let title: String
|
|
let subtitle: String
|
|
|
|
var body: some View {
|
|
VStack(spacing: 12) {
|
|
Image(systemName: icon)
|
|
.font(.system(size: 40))
|
|
.foregroundStyle(Color.text4)
|
|
|
|
Text(title)
|
|
.font(.headline)
|
|
.foregroundStyle(Color.text2)
|
|
|
|
Text(subtitle)
|
|
.font(.subheadline)
|
|
.foregroundStyle(Color.text3)
|
|
.multilineTextAlignment(.center)
|
|
}
|
|
.padding(40)
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
}
|