The post-gate main surface is the workspace shell from the design
contract: nav rail (Posts/Sessions/Learnings/Settings), Posts pane
mirroring <home>/posts/ on disk (Pass State groups, origin meta,
empty state; lazy folders skipped), Settings pane with repoint-only
Home picking (NSOpenPanel + UserDefaults, default ~/Documents/Museion
per b3daac9), placeholder panes until #28/#26. Column collapse
mirrors the export's media queries so narrow windows never clip.
Mentor pane becomes the fourth column (#14 surface preserved).
[Generated by AI]
84 lines
2.3 KiB
Swift
84 lines
2.3 KiB
Swift
//
|
|
// ContentView.swift
|
|
// Museion
|
|
//
|
|
// Created by Alexander Kucera on 26.08.26.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
enum AppMetadata {
|
|
nonisolated static let name = "Museion"
|
|
nonisolated static let tagline = "The Agentic Writing Environment"
|
|
}
|
|
|
|
struct ContentView: View {
|
|
@Environment(AppGateState.self) private var gate
|
|
|
|
/// #48: provisioning failure presents only once the gate sheet has fully
|
|
/// dismissed — keying on `gateDismissed` (set in the sheet's onDismiss,
|
|
/// which fires at dismissal completion) rather than `!gateRaised` (which
|
|
/// flips at dismissal start); macOS can drop a sheet presented during
|
|
/// another sheet's dismissal animation.
|
|
private var failurePresented: Binding<Bool> {
|
|
Binding(
|
|
get: { gate.provisioning.hasFailure && gate.gateDismissed },
|
|
set: {
|
|
if !$0 {
|
|
gate.provisioning.deferFailure()
|
|
}
|
|
},
|
|
)
|
|
}
|
|
|
|
var body: some View {
|
|
@Bindable var gate = gate
|
|
|
|
Group {
|
|
// #17: post-gate main surface is the workspace shell (nav rail +
|
|
// Posts/Sessions/Learnings/Settings). Gate pass hands over the probe's
|
|
// winning binary — no re-probe.
|
|
if gate.gateModel.currentBinaryPath != nil {
|
|
WorkspaceView()
|
|
} else {
|
|
VStack(spacing: 8) {
|
|
Image(systemName: "books.vertical")
|
|
.font(.largeTitle)
|
|
Text(AppMetadata.name)
|
|
.font(.title)
|
|
.bold()
|
|
Text(AppMetadata.tagline)
|
|
.foregroundStyle(.secondary)
|
|
}
|
|
.padding(32)
|
|
}
|
|
}
|
|
.frame(minWidth: 480, minHeight: 320)
|
|
.sheet(isPresented: $gate.gateRaised) {
|
|
EngineGateView(
|
|
model: gate.gateModel,
|
|
onEnginePass: {
|
|
// #47: provisioning runs in parallel on pass; idempotent, so re-fires
|
|
// are no-ops. Alert UX on failure is #48.
|
|
// #50: backup runs after the provision pass finishes — success or
|
|
// failure; a failed provision doesn't skip the backup.
|
|
Task {
|
|
await gate.provisioning.runPass(hermesBinary: gate.gateModel.currentBinaryPath)
|
|
await gate.backup.runPass()
|
|
}
|
|
},
|
|
onDismiss: {
|
|
gate.gateRaised = false
|
|
gate.gateDismissed = true
|
|
},
|
|
)
|
|
}
|
|
.sheet(isPresented: failurePresented) {
|
|
ProvisioningFailureCard(model: gate.provisioning) {
|
|
Task { await gate.provisioning.runPass(hermesBinary: gate.gateModel.currentBinaryPath) }
|
|
}
|
|
.interactiveDismissDisabled()
|
|
}
|
|
}
|
|
}
|