diff --git a/apps/swift-ios/Features/Chat/FeatureComposerRequestViews.swift b/apps/swift-ios/Features/Chat/FeatureComposerRequestViews.swift index e3ecefa4c2..0b0e4db730 100644 --- a/apps/swift-ios/Features/Chat/FeatureComposerRequestViews.swift +++ b/apps/swift-ios/Features/Chat/FeatureComposerRequestViews.swift @@ -147,7 +147,7 @@ struct FeatureComposerUserInputPanel: View { .font(.caption2.weight(.bold)) .tracking(1.3) .textCase(.uppercase) - .foregroundStyle(Color.indigo.opacity(0.95)) + .foregroundStyle(T3Colors.accent) Spacer() @@ -303,7 +303,7 @@ struct FeatureComposerUserInputPanel: View { if isSelected { Image(systemName: "checkmark") .font(.caption.weight(.bold)) - .foregroundStyle(Color.indigo.opacity(0.95)) + .foregroundStyle(T3Colors.accent) } else if number <= 9 { Text("\(number)") .font(.caption2.monospacedDigit().weight(.semibold)) @@ -319,13 +319,13 @@ struct FeatureComposerUserInputPanel: View { .padding(.vertical, 9) .frame(maxWidth: .infinity, minHeight: T3Metrics.minimumTapTarget, alignment: .leading) .background( - isSelected ? Color.indigo.opacity(0.12) : Color.white.opacity(0.045), + isSelected ? T3Colors.accent.opacity(0.12) : Color.white.opacity(0.045), in: RoundedRectangle(cornerRadius: 10) ) .overlay { RoundedRectangle(cornerRadius: 10) .stroke( - isSelected ? Color.indigo.opacity(0.46) : Color.clear, + isSelected ? T3Colors.accent.opacity(0.46) : Color.clear, lineWidth: 1 ) } diff --git a/apps/swift-ios/Features/Chat/FeatureComposerView.swift b/apps/swift-ios/Features/Chat/FeatureComposerView.swift index c6fd1201b9..5f4dc09b4e 100644 --- a/apps/swift-ios/Features/Chat/FeatureComposerView.swift +++ b/apps/swift-ios/Features/Chat/FeatureComposerView.swift @@ -125,11 +125,6 @@ struct FeatureComposerView: View { private var collapsedComposer: some View { HStack(spacing: 4) { - FeatureImageAttachmentPicker( - attachments: $attachments, - isEnabled: imagesAllowed - ) - Button { isManuallyExpanded = true Task { @MainActor in @@ -151,7 +146,7 @@ struct FeatureComposerView: View { submitButton .padding(.trailing, 7) } - .padding(.leading, 3) + .padding(.leading, 12) .padding(.vertical, 5) } @@ -333,7 +328,7 @@ struct FeatureComposerView: View { } private var showsStop: Bool { - isWorking + isWorking && textIsEmpty && attachments.isEmpty } private var submitDisabled: Bool { diff --git a/apps/swift-ios/Features/Chat/ThreadDetailView.swift b/apps/swift-ios/Features/Chat/ThreadDetailView.swift index d6f716afbd..66a97c7a52 100644 --- a/apps/swift-ios/Features/Chat/ThreadDetailView.swift +++ b/apps/swift-ios/Features/Chat/ThreadDetailView.swift @@ -170,11 +170,12 @@ public struct ThreadDetailView: View { Image(systemName: icon) .font(.system(size: 10.5, weight: .semibold)) } - Text(currentThread.homeStatusLabel ?? "Ready") if let duration = currentThread.homeWorkingDuration(at: now) { Text(duration) .font(.system(size: 10.5, weight: .semibold, design: .monospaced)) .monospacedDigit() + } else { + Text(currentThread.homeStatusLabel ?? "Ready") } } .font(.system(size: 11.5, weight: .semibold)) @@ -309,13 +310,6 @@ public struct ThreadDetailView: View { .id(message.id) } - if detail.thread.state == .working || detail.thread.state == .queued { - StreamingStatusView( - state: detail.thread.state - ) - .id("streaming-status") - } - Color.clear.frame(height: 1).id("timeline-bottom") } .padding(.horizontal, 15) @@ -377,6 +371,7 @@ public struct ThreadDetailView: View { } draft = "" attachments = [] + composerFocused = false isSending = true Task { let sent = await submitMessage( @@ -400,9 +395,9 @@ public struct ThreadDetailView: View { !pendingIDs.contains($0.id) } sendFailed = true + composerFocused = true } isSending = false - composerFocused = true } } @@ -680,19 +675,3 @@ private struct FeatureAttachmentPreview: View { .preferredColorScheme(.dark) } } - -struct StreamingStatusView: View { - let state: FeatureThreadState - - var body: some View { - HStack(spacing: 9) { - Image(systemName: state == .queued ? "clock" : "circle.dotted") - .foregroundStyle(T3Colors.statusRunning) - Text(state == .queued ? "Queued" : "Agent working") - .foregroundStyle(T3Colors.textSecondary) - } - .font(.caption.monospaced().weight(.medium)) - .padding(.vertical, 4) - .accessibilityElement(children: .combine) - } -} diff --git a/apps/swift-ios/Features/Workspace/NewThreadView.swift b/apps/swift-ios/Features/Workspace/NewThreadView.swift index 7a0a2ae426..fe51c7d510 100644 --- a/apps/swift-ios/Features/Workspace/NewThreadView.swift +++ b/apps/swift-ios/Features/Workspace/NewThreadView.swift @@ -93,7 +93,7 @@ public struct NewThreadView: View { private var hero: some View { VStack(spacing: 10) { Text("What should we build") - HStack(spacing: 3) { + HStack(spacing: 0) { Text("in") Menu { ForEach(creationProjects) { project in @@ -122,7 +122,6 @@ public struct NewThreadView: View { } .buttonStyle(.plain) Text("?") - .offset(x: -1) } } .font(.system(size: 24, weight: .regular)) diff --git a/apps/swift-ios/Features/Workspace/WorkspaceView.swift b/apps/swift-ios/Features/Workspace/WorkspaceView.swift index dac8cbc2c8..8fcb66fd93 100644 --- a/apps/swift-ios/Features/Workspace/WorkspaceView.swift +++ b/apps/swift-ios/Features/Workspace/WorkspaceView.swift @@ -599,7 +599,7 @@ public struct WorkspaceView: View { snapshot: model.snapshot, now: sidebarClock, isSelected: selectedThreadID == thread.id, - isConnectionStale: isConnectionStale(for: thread), + connectionState: connectionState(for: thread), style: dynamicTypeSize.isAccessibilitySize ? .rich : style ) } @@ -758,18 +758,22 @@ public struct WorkspaceView: View { return max(0.25, min(60, nextSnooze ?? 60)) } - private func isConnectionStale(for thread: FeatureThread) -> Bool { + private func connectionState(for thread: FeatureThread) -> FeatureConnection.State? { let projectEnvironmentID = model.snapshot.projects .first(where: { $0.id == thread.projectID })? .environmentID let environmentID = thread.environmentID ?? projectEnvironmentID - if let environment = model.snapshot.environments.first(where: { $0.id == environmentID }), - environment.connectionState == .disconnected { - return true + if let environment = model.snapshot.environments.first(where: { $0.id == environmentID }) { + if let state = environment.connectionState { + return state + } + return environment.isActive ? model.snapshot.connection.state : nil } - guard model.snapshot.connection.state == .disconnected else { return false } let activeID = model.snapshot.environments.first(where: \.isActive)?.id - return environmentID == nil || activeID == nil || environmentID == activeID + if environmentID == nil || activeID == nil || environmentID == activeID { + return model.snapshot.connection.state + } + return nil } private func projectName(for thread: FeatureThread) -> String { @@ -867,7 +871,7 @@ struct FeatureThreadRow: View { let snapshot: FeatureSnapshot let now: Date let isSelected: Bool - let isConnectionStale: Bool + let connectionState: FeatureConnection.State? let style: Style init( @@ -876,7 +880,7 @@ struct FeatureThreadRow: View { snapshot: FeatureSnapshot, now: Date = .now, isSelected: Bool = false, - isConnectionStale: Bool = false, + connectionState: FeatureConnection.State? = nil, style: Style = .rich ) { self.thread = thread @@ -884,7 +888,7 @@ struct FeatureThreadRow: View { self.snapshot = snapshot self.now = now self.isSelected = isSelected - self.isConnectionStale = isConnectionStale + self.connectionState = connectionState self.style = style } @@ -937,16 +941,12 @@ struct FeatureThreadRow: View { Spacer(minLength: 8) if let environmentLabel { HStack(spacing: 4) { - Image(systemName: "server.rack") + Image(systemName: environmentIcon) .font(.system(size: 9)) Text(environmentLabel) .lineLimit(1) } - .foregroundStyle( - isConnectionStale - ? T3Colors.danger.opacity(0.72) - : Color.white.opacity(0.36) - ) + .foregroundStyle(environmentColor) } Image(systemName: "sparkles") .font(.system(size: 9)) @@ -965,7 +965,6 @@ struct FeatureThreadRow: View { in: RoundedRectangle(cornerRadius: 8) ) .padding(.horizontal, 8) - .opacity(isConnectionStale ? 0.58 : 1) } private var slimRow: some View { @@ -1035,6 +1034,34 @@ struct FeatureThreadRow: View { thread.homeEnvironmentLabel(in: snapshot) } + private var environmentIcon: String { + switch connectionState { + case .connecting, .reconnecting: + "wifi" + case .disconnected: + "wifi.slash" + case .connected, nil: + "server.rack" + } + } + + private var environmentColor: Color { + switch connectionState { + case .connecting, .reconnecting: + T3Colors.warning.opacity(0.78) + case .disconnected: + T3Colors.danger.opacity(0.78) + case .connected, nil: + Color.white.opacity(0.36) + } + } + + private var isConnectionStale: Bool { + connectionState == .connecting + || connectionState == .reconnecting + || connectionState == .disconnected + } + private var branchLabel: String { if let branch = thread.branch?.trimmingCharacters(in: .whitespacesAndNewlines), !branch.isEmpty {