Add scan flow MVP and local Axiom skill workspace

This snapshot establishes the camera-to-result recognition flow and related tests while checking in the project skill/docs assets required for the configured local tooling.
This commit is contained in:
Matthias
2026-04-19 21:11:32 +02:00
parent 577214d474
commit a60a76b797
679 changed files with 138964 additions and 73 deletions

View File

@@ -5,57 +5,35 @@
// Created by Matthias Meister on 18.04.26.
//
import SwiftUI
import SwiftData
import SwiftUI
struct ContentView: View {
@Environment(\.modelContext) private var modelContext
@Query private var items: [Item]
@StateObject private var flowModel = ScanFlowModel()
var body: some View {
NavigationSplitView {
List {
ForEach(items) { item in
NavigationLink {
Text("Item at \(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))")
} label: {
Text(item.timestamp, format: Date.FormatStyle(date: .numeric, time: .standard))
NavigationStack(path: $flowModel.path) {
ScanView(flowModel: flowModel)
.navigationDestination(for: ScanRoute.self) { route in
switch route {
case .result:
ResultEditorView(flowModel: flowModel, mode: .recognized)
case .manual:
ResultEditorView(flowModel: flowModel, mode: .manual)
}
}
.onDelete(perform: deleteItems)
}
.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
EditButton()
.task {
flowModel.startObservers()
await flowModel.prepareVisibleServices()
}
ToolbarItem {
Button(action: addItem) {
Label("Add Item", systemImage: "plus")
}
.onDisappear {
flowModel.stopObservers()
}
}
} detail: {
Text("Select an item")
}
}
private func addItem() {
withAnimation {
let newItem = Item(timestamp: Date())
modelContext.insert(newItem)
}
}
private func deleteItems(offsets: IndexSet) {
withAnimation {
for index in offsets {
modelContext.delete(items[index])
}
}
}
}
#Preview {
ContentView()
.modelContainer(for: Item.self, inMemory: true)
.modelContainer(for: ConfirmedScanRecord.self, inMemory: true)
}