1→import SwiftUI 2→ 3→struct SidebarView: View { 4→ @EnvironmentObject var appState: AppState 5→ 6→ var body: some View { 7→ List(selection: $appState.selectedCategory) { 8→ Section("Main") { 9→ ForEach([SidebarCategory.dashboard, .monitoring, .services]) { category in 10→ NavigationLink(value: category) { 11→ Label(category.rawValue, systemImage: category.icon) 12→ } 13→ .badge(badgeCount(for: category)) 14→ } 15→ } 16→ 17→ Section("Content") { 18→ NavigationLink(value: SidebarCategory.webApps) { 19→ Label("Web Apps", systemImage: "globe") 20→ } 21→ .badge(368) 22→ } 23→ 24→ Section { 25→ NavigationLink(value: SidebarCategory.settings) { 26→ Label("Settings", systemImage: "gear") 27→ } 28→ } 29→ } 30→ .listStyle(.sidebar) 31→ .navigationTitle("NEOG Command") 32→ .toolbar { 33→ ToolbarItem(placement: .automatic) { 34→ ConnectionStatusView() 35→ } 36→ } 37→ .safeAreaInset(edge: .bottom) { 38→ bottomStatusBar 39→ } 40→ } 41→ 42→ private func badgeCount(for category: SidebarCategory) -> Int { 43→ switch category { 44→ case .monitoring: 45→ return appState.recentRuns.count 46→ case .services: 47→ return appState.services.filter { $0.isRunning }.count 48→ default: 49→ return 0 50→ } 51→ } 52→ 53→ private var bottomStatusBar: some View { 54→ VStack(spacing: 4) { 55→ Divider() 56→ 57→ HStack { 58→ if let summary = appState.roiSummary { 59→ VStack(alignment: .leading, spacing: 2) { 60→ Text("Today's ROI") 61→ .font(.caption2) 62→ .foregroundStyle(.secondary) 63→ Text(String(format: "%.0f%%", summary.roiPercent)) 64→ .font(.headline) 65→ .foregroundStyle(summary.roiPercent >= 100 ? .green : .orange) 66→ } 67→ 68→ Spacer() 69→ 70→ VStack(alignment: .trailing, spacing: 2) { 71→ Text("Cost") 72→ .font(.caption2) 73→ .foregroundStyle(.secondary) 74→ Text(String(format: "$%.2f", summary.totalCost)) 75→ .font(.headline.monospacedDigit()) 76→ } 77→ } else { 78→ Text("Loading...") 79→ .font(.caption) 80→ .foregroundStyle(.secondary) 81→ } 82→ } 83→ .padding(.horizontal) 84→ .padding(.bottom, 8) 85→ } 86→ .background(Color(nsColor: .windowBackgroundColor)) 87→ } 88→} 89→ 90→struct ConnectionStatusView: View { 91→ @EnvironmentObject var appState: AppState 92→ 93→ var body: some View { 94→ HStack(spacing: 8) { 95→ // Connection indicator 96→ HStack(spacing: 4) { 97→ Circle() 98→ .fill(statusColor) 99→ .frame(width: 8, height: 8) 100→ .overlay { 101→ if appState.connectionState == .connecting || appState.connectionState == .reconnecting { 102→ Circle() 103→ .stroke(statusColor.opacity(0.5), lineWidth: 2) 104→ .scaleEffect(1.5) 105→ .opacity(0.8) 106→ } 107→ } 108→ .animation(.easeInOut(duration: 0.5).repeatForever(autoreverses: true), value: appState.connectionState) 109→ 110→ Text(appState.connectionState.rawValue) 111→ .font(.caption) 112→ .foregroundStyle(.secondary) 113→ } 114→ 115→ // Last sync time 116→ if let lastSync = appState.lastSyncDate { 117→ Text(lastSync, style: .relative) 118→ .font(.caption2) 119→ .foregroundStyle(.tertiary) 120→ } 121→ 122→ // Refresh button 123→ Button { 124→ Task { 125→ await appState.forceRefresh() 126→ } 127→ } label: { 128→ Image(systemName: "arrow.clockwise") 129→ .font(.caption) 130→ } 131→ .buttonStyle(.plain) 132→ .help("Force Refresh") 133→ } 134→ } 135→ 136→ private var statusColor: Color { 137→ switch appState.connectionState { 138→ case .connected: return .green 139→ case .connecting, .reconnecting: return .orange 140→ case .disconnected, .error: return .red 141→ } 142→ } 143→} 144→ 145→#Preview { 146→ SidebarView() 147→ .environmentObject(AppState()) 148→ .frame(width: 250, height: 600) 149→} 150→ Whenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing. But you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer questions about the code behavior.