feat: wire list view models into AppModel, add strings, list helpers and debug snapshot mode

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 15:46:29 +02:00
co-authored by Claude Sonnet 5.5
parent fffd9d7022
commit daacfa20c8
6 changed files with 179 additions and 9 deletions
+31
View File
@@ -0,0 +1,31 @@
#if DEBUG
import AppKit
import SstUI
import SwiftUI
@MainActor
enum Snapshot {
static func run(prefix: String) {
_ = NSApplication.shared
SnapshotMode.isActive = true
let model = AppModel(preview: true)
for section in AppModel.Section.allCases {
model.section = section
let view = HStack(spacing: 0) {
MainWindow().environment(\.colorScheme, .light)
MainWindow().environment(\.colorScheme, .dark)
}
.environmentObject(model)
.environmentObject(model.settings)
.frame(width: Layout.windowDefaultWidth * 2, height: Layout.windowDefaultHeight)
let renderer = ImageRenderer(content: view)
renderer.scale = 1
if let tiff = renderer.nsImage?.tiffRepresentation,
let png = NSBitmapImageRep(data: tiff)?.representation(using: .png, properties: [:]) {
try? png.write(to: URL(fileURLWithPath: "\(prefix)-\(section.rawValue).png"))
}
}
}
}
#endif