Feat: Fixing equipment settings form

This commit is contained in:
2024-06-05 10:13:41 -04:00
parent 6ec3eacb8d
commit c13b3740f2
10 changed files with 545 additions and 693 deletions

View File

@@ -34,109 +34,3 @@ extension FlaggedView where Label == EmptyView {
self.init(flagged: flagged) { EmptyView() }
}
}
//public struct FlaggedView: View {
//
// public let style: Style?
// public let title: String
// public let flagged: Flagged
// public let fractionLength: Int
//
// public init(
// style: Style? = nil,
// title: String,
// flagged: Flagged,
// fractionLength: Int = 3
// ) {
// self.style = style
// self.title = title
// self.flagged = flagged
// self.fractionLength = fractionLength
// }
//
// public init(
// _ title: String,
// flagged: Flagged,
// style: Style? = nil,
// fractionLength: Int = 3
// ) {
// self.style = style
// self.title = title
// self.flagged = flagged
// self.fractionLength = fractionLength
// }
//
// @ViewBuilder
// private var messageView: some View {
// if let message = flagged.message {
// HStack {
// Text(flagged.projectedValue.key.title)
// .bold()
// .foregroundStyle(flagged.projectedValue.key.flagColor)
//
// Text(message)
// .foregroundStyle(Color.secondary)
// }
// .font(.caption)
// }
// }
//
// public var body: some View {
// switch style {
// case .none:
// VStack(alignment: .leading, spacing: 8) {
// HStack {
// Text(title)
// .foregroundStyle(Color.secondary)
// Spacer()
// Text(
// flagged.wrappedValue,
// format: .number.precision(.fractionLength(fractionLength))
// )
// Image(systemName: "flag.fill")
// .foregroundStyle(flagged.projectedValue.key.flagColor)
// }
// messageView
// }
// case .some(.gridRow):
// GridRow {
// VStack(alignment: .leading, spacing: 8) {
// Text(title)
// .foregroundStyle(Color.secondary)
// messageView
// }
//
// Spacer()
//
// Text(flagged.wrappedValue, format: .number.precision(.fractionLength(fractionLength)))
// .gridCellAnchor(.trailing)
//
// Image(systemName: "flag.fill")
// .foregroundStyle(flagged.flagColor)
// .gridCellAnchor(.trailing)
// }
//
// }
// }
//
// public enum Style {
// case gridRow
// }
//
// public static func gridRow(_ title: String, flagged: Flagged) -> Self {
// .init(style: .gridRow, title: title, flagged: flagged)
// }
//}
//#Preview {
// List {
// Grid(horizontalSpacing: 20) {
// FlaggedView(style: .gridRow, title: "Test", flagged: .error(message: "Error message"))
// FlaggedView(style: .gridRow, title: "Test", flagged: .init(wrappedValue: 0.5, .result(.good("Good message"))))
// }
//
// FlaggedView(style: nil, title: "Test", flagged: .error(message: "Error message"))
// FlaggedView(style: nil, title: "Test", flagged: .init(wrappedValue: 0.5, .result(.good("Good message"))))
// }
//}