CxWebApp/swift-app/Sources/CxWebAppMac/CxLLMSidebar.swift
CxAI Agent 055e350108
Some checks are pending
build-and-push / image (push) Waiting to run
feat: initial CxWebApp (macOS shell + swift-app wired to CxLLM-SDK)
2026-05-16 14:32:01 -05:00

90 lines
3.3 KiB
Swift

// CxLLMSidebar sidebar navigation for the CxLLM module surface, alongside the WebView.
// Phase 4 wiring: each section imports its CxLLM-SDK module and renders a status card.
// Real per-module UI lands in Phase 3.
import SwiftUI
import CxCode
import CxAWS
import CxGit
import CxAgent
import CxMCP
import CxModels
import CxChat
import CxInstrument
import CxLangBridge
enum SidebarItem: String, Identifiable, CaseIterable, Hashable {
case web = "Web"
case chat = "Chat"
case agent = "Agent"
case mcp = "MCP"
case models = "Models"
case code = "Code"
case aws = "AWS"
case git = "Git"
case bridge = "LangBridge"
case telemetry = "Telemetry"
var id: String { rawValue }
var systemImage: String {
switch self {
case .web: return "globe"
case .chat: return "bubble.left.and.bubble.right"
case .agent: return "person.crop.square.filled.and.at.rectangle"
case .mcp: return "antenna.radiowaves.left.and.right"
case .models: return "cube.transparent"
case .code: return "chevron.left.forwardslash.chevron.right"
case .aws: return "cloud"
case .git: return "arrow.triangle.branch"
case .bridge: return "link"
case .telemetry: return "waveform.path.ecg"
}
}
}
struct CxLLMSectionView: View {
let item: SidebarItem
var body: some View {
VStack(alignment: .leading, spacing: 16) {
Label(item.rawValue, systemImage: item.systemImage)
.font(.title)
Divider()
switch item {
case .chat: moduleCard(name: "CxChat", version: "seed")
case .agent: moduleCard(name: "CxAgent", version: "seed")
case .mcp: moduleCard(name: "CxMCP", version: "seed")
case .models: moduleCard(name: "CxModels", version: "seed")
case .code: moduleCard(name: "CxCode", version: "seed")
case .aws: moduleCard(name: "CxAWS", version: "seed")
case .git: moduleCard(name: "CxGit", version: "seed")
case .bridge: moduleCard(name: "CxLangBridge", version: "seed")
case .telemetry: moduleCard(name: "CxInstrument", version: "seed")
case .web: EmptyView()
}
Spacer()
}
.padding(24)
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
}
@ViewBuilder
private func moduleCard(name: String, version: String) -> some View {
VStack(alignment: .leading, spacing: 8) {
Text(name).font(.headline)
Text("Imported from CxLLM-SDK. Phase 3 will replace this card with the real UI surface.")
.font(.callout).foregroundStyle(.secondary)
HStack(spacing: 12) {
Text("module").font(.caption2).foregroundStyle(.tertiary)
Text(name).font(.caption.monospaced())
Text("").font(.caption2).foregroundStyle(.tertiary)
Text("v\(version)").font(.caption.monospaced())
}
.padding(.top, 4)
}
.padding(16)
.background(.quaternary.opacity(0.4), in: RoundedRectangle(cornerRadius: 10))
}
}