From cdea7447255c6c3864fb6d4506d1c32435117ada Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 17 Dec 2025 17:28:26 +0100 Subject: [PATCH] ui(chat): move connection pill into composer --- .../Sources/ClawdisChatUI/ChatComposer.swift | 36 +++++++++++++++++- .../Sources/ClawdisChatUI/ChatView.swift | 38 +------------------ 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatComposer.swift b/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatComposer.swift index 3039759b7..ac7b8d7db 100644 --- a/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatComposer.swift +++ b/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatComposer.swift @@ -21,6 +21,7 @@ struct ClawdisChatComposer: View { HStack(spacing: 10) { self.thinkingPicker Spacer() + self.refreshButton self.attachmentPicker } @@ -134,12 +135,32 @@ struct ClawdisChatComposer: View { self.editorOverlay } .overlay(alignment: .bottomTrailing) { - self.sendButton - .padding(8) + VStack(alignment: .trailing, spacing: 6) { + self.connectionPill + self.sendButton + } + .padding(8) } .frame(minHeight: 44, idealHeight: 44, maxHeight: 96) } + private var connectionPill: some View { + HStack(spacing: 6) { + Circle() + .fill(self.viewModel.healthOK ? .green : .orange) + .frame(width: 7, height: 7) + Text(self.viewModel.sessionKey) + .font(.caption2.weight(.semibold)) + Text(self.viewModel.healthOK ? "Connected" : "Connecting…") + .font(.caption2) + .foregroundStyle(.secondary) + } + .padding(.horizontal, 10) + .padding(.vertical, 6) + .background(ClawdisChatTheme.subtleCard) + .clipShape(Capsule()) + } + private var editorOverlay: some View { ZStack(alignment: .topLeading) { if self.viewModel.input.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { @@ -203,6 +224,17 @@ struct ClawdisChatComposer: View { } } + private var refreshButton: some View { + Button { + self.viewModel.refresh() + } label: { + Image(systemName: "arrow.clockwise") + } + .buttonStyle(.bordered) + .controlSize(.small) + .help("Refresh") + } + #if os(macOS) private func pickFilesMac() { let panel = NSOpenPanel() diff --git a/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatView.swift b/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatView.swift index fa7da2be6..986eb940f 100644 --- a/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatView.swift +++ b/apps/shared/ClawdisKit/Sources/ClawdisChatUI/ChatView.swift @@ -66,7 +66,7 @@ public struct ClawdisChatView: View { .frame(height: 1) .id(self.scrollerBottomID) } - .padding(.top, 40) + .padding(.top, 12) .padding(.bottom, 10) .padding(.horizontal, 12) } @@ -74,42 +74,6 @@ public struct ClawdisChatView: View { RoundedRectangle(cornerRadius: 16, style: .continuous) .fill(ClawdisChatTheme.card) .shadow(color: .black.opacity(0.05), radius: 12, y: 6)) - .overlay(alignment: .topLeading) { - HStack(spacing: 8) { - Circle() - .fill(self.viewModel.healthOK ? .green : .orange) - .frame(width: 7, height: 7) - Text(self.viewModel.sessionKey) - .font(.caption.weight(.semibold)) - Text(self.viewModel.healthOK ? "Connected" : "Connecting…") - .font(.caption) - .foregroundStyle(.secondary) - Spacer(minLength: 0) - - if self.showsSessionSwitcher { - Button { - self.showSessions = true - } label: { - Image(systemName: "tray.full") - } - .buttonStyle(.borderless) - .help("Sessions") - } - - Button { - self.viewModel.refresh() - } label: { - Image(systemName: "arrow.clockwise") - } - .buttonStyle(.borderless) - .help("Refresh") - } - .padding(.horizontal, 10) - .padding(.vertical, 6) - .background(ClawdisChatTheme.subtleCard) - .clipShape(Capsule()) - .padding(10) - } .onChange(of: self.viewModel.messages.count) { _, _ in withAnimation(.snappy(duration: 0.22)) { proxy.scrollTo(self.scrollerBottomID, anchor: .bottom)