XcodeGen-managed project (project.yml), SwiftUI single-window app 1280x800 / min 1100x700, dark theme tokens from docs/21, 270pt sidebar with logo/preset select/Calibrate/stepper 1-5, notice banner, five stage placeholders, ICCeryCore SPM package with AppPaths + WizardStage, Swift Testing plumbing. Sandbox off, hardened runtime on, bundle id com.gronod.iccery2. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
63 lines
1.6 KiB
Swift
63 lines
1.6 KiB
Swift
import SwiftUI
|
|
|
|
/// Banner notice model — the v2 equivalent of `#wizardNotification`
|
|
/// (docs/21 §Banner).
|
|
struct Notice: Identifiable, Equatable {
|
|
enum Kind: Equatable {
|
|
case info, warning, error
|
|
|
|
var symbolName: String {
|
|
switch self {
|
|
case .info: return "info.circle"
|
|
case .warning: return "exclamationmark.triangle"
|
|
case .error: return "xmark.octagon"
|
|
}
|
|
}
|
|
|
|
var tint: Color {
|
|
switch self {
|
|
case .info: return Theme.accent
|
|
case .warning: return .orange
|
|
case .error: return .red
|
|
}
|
|
}
|
|
}
|
|
|
|
let id = UUID()
|
|
let kind: Kind
|
|
let text: String
|
|
/// Auto-dismiss interval; `nil` keeps the banner until closed.
|
|
var autoHideAfter: TimeInterval? = 6
|
|
}
|
|
|
|
struct NoticeBanner: View {
|
|
let notice: Notice
|
|
let onClose: () -> Void
|
|
|
|
var body: some View {
|
|
HStack(spacing: 10) {
|
|
Image(systemName: notice.kind.symbolName)
|
|
.foregroundStyle(notice.kind.tint)
|
|
Text(notice.text)
|
|
.font(.callout)
|
|
.foregroundStyle(Theme.text)
|
|
.lineLimit(3)
|
|
Spacer()
|
|
Button(action: onClose) {
|
|
Image(systemName: "xmark")
|
|
}
|
|
.buttonStyle(.plain)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
.padding(.horizontal, 12)
|
|
.padding(.vertical, 8)
|
|
.background(Theme.panel)
|
|
.overlay(
|
|
Rectangle()
|
|
.frame(height: 1)
|
|
.foregroundStyle(Theme.border),
|
|
alignment: .bottom
|
|
)
|
|
}
|
|
}
|