ghostty/macos/Sources/Features/Settings/ConfigurationErrorsView.swift
2023-09-11 13:21:13 -07:00

48 lines
1.6 KiB
Swift

import SwiftUI
struct ConfigurationErrorsView: View {
class Model: ObservableObject {
@Published var errors: [String] = []
}
var model: Model
var body: some View {
VStack {
HStack {
Image(systemName: "exclamationmark.triangle.fill")
.foregroundColor(.yellow)
.font(.system(size: 52))
.padding()
.frame(alignment: .center)
Text("""
^[\(model.errors.count) error was](inflect: true) found while loading the configuration. \
Please review the errors below and reload your configuration.
""")
.frame(maxWidth: .infinity, alignment: .leading)
.padding()
}
GeometryReader { geo in
ScrollView {
VStack {
ForEach(model.errors, id: \.self) { error in
Text(error)
.lineLimit(nil)
.font(.system(size: 12).monospaced())
.textSelection(.enabled)
.padding(.all)
.frame(maxWidth: .infinity, alignment: .topLeading)
}
Spacer()
}
.frame(height: geo.size.height)
.background(Color.white)
}
}
}
.frame(minWidth: 480, maxWidth: 960, minHeight: 270)
}
}