34 lines
1019 B
Swift
34 lines
1019 B
Swift
import SwiftUI
|
|
|
|
struct StorageErrorView: View {
|
|
|
|
@EnvironmentObject
|
|
private var content: Content
|
|
|
|
@Binding
|
|
var isPresented: Bool
|
|
|
|
var body: some View {
|
|
VStack {
|
|
Text("Failed to load database")
|
|
.font(.headline)
|
|
List(content.storageErrors) { error in
|
|
VStack {
|
|
Text(error.message)
|
|
Text(error.date.formatted())
|
|
.font(.footnote)
|
|
}
|
|
}
|
|
.frame(minHeight: 300)
|
|
if content.saveState == .savingPausedDueToLoadErrors {
|
|
Button("Allow saving", action: { content.resumeSavingAfterLoadingErrors() })
|
|
.padding()
|
|
Text("Saving has been disabled to prevent data corruption due to loading errors. Enable saving to save the partially loaded data.")
|
|
}
|
|
Button("Dismiss", action: { isPresented = false })
|
|
.padding()
|
|
}
|
|
.padding()
|
|
}
|
|
}
|