ui(chat): move connection pill into composer
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user