ui(chat): move connection pill into composer
parent
44365f2e27
commit
cdea744725
|
|
@ -21,6 +21,7 @@ struct ClawdisChatComposer: View {
|
||||||
HStack(spacing: 10) {
|
HStack(spacing: 10) {
|
||||||
self.thinkingPicker
|
self.thinkingPicker
|
||||||
Spacer()
|
Spacer()
|
||||||
|
self.refreshButton
|
||||||
self.attachmentPicker
|
self.attachmentPicker
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -134,12 +135,32 @@ struct ClawdisChatComposer: View {
|
||||||
self.editorOverlay
|
self.editorOverlay
|
||||||
}
|
}
|
||||||
.overlay(alignment: .bottomTrailing) {
|
.overlay(alignment: .bottomTrailing) {
|
||||||
self.sendButton
|
VStack(alignment: .trailing, spacing: 6) {
|
||||||
.padding(8)
|
self.connectionPill
|
||||||
|
self.sendButton
|
||||||
|
}
|
||||||
|
.padding(8)
|
||||||
}
|
}
|
||||||
.frame(minHeight: 44, idealHeight: 44, maxHeight: 96)
|
.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 {
|
private var editorOverlay: some View {
|
||||||
ZStack(alignment: .topLeading) {
|
ZStack(alignment: .topLeading) {
|
||||||
if self.viewModel.input.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
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)
|
#if os(macOS)
|
||||||
private func pickFilesMac() {
|
private func pickFilesMac() {
|
||||||
let panel = NSOpenPanel()
|
let panel = NSOpenPanel()
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public struct ClawdisChatView: View {
|
||||||
.frame(height: 1)
|
.frame(height: 1)
|
||||||
.id(self.scrollerBottomID)
|
.id(self.scrollerBottomID)
|
||||||
}
|
}
|
||||||
.padding(.top, 40)
|
.padding(.top, 12)
|
||||||
.padding(.bottom, 10)
|
.padding(.bottom, 10)
|
||||||
.padding(.horizontal, 12)
|
.padding(.horizontal, 12)
|
||||||
}
|
}
|
||||||
|
|
@ -74,42 +74,6 @@ public struct ClawdisChatView: View {
|
||||||
RoundedRectangle(cornerRadius: 16, style: .continuous)
|
RoundedRectangle(cornerRadius: 16, style: .continuous)
|
||||||
.fill(ClawdisChatTheme.card)
|
.fill(ClawdisChatTheme.card)
|
||||||
.shadow(color: .black.opacity(0.05), radius: 12, y: 6))
|
.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
|
.onChange(of: self.viewModel.messages.count) { _, _ in
|
||||||
withAnimation(.snappy(duration: 0.22)) {
|
withAnimation(.snappy(duration: 0.22)) {
|
||||||
proxy.scrollTo(self.scrollerBottomID, anchor: .bottom)
|
proxy.scrollTo(self.scrollerBottomID, anchor: .bottom)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue