ChatUI: swiftformat fixes
parent
6652b1f4f3
commit
ca85d217ec
|
|
@ -130,15 +130,15 @@ struct ClawdisChatComposer: View {
|
|||
.background(
|
||||
RoundedRectangle(cornerRadius: 12, style: .continuous)
|
||||
.fill(ClawdisChatTheme.card))
|
||||
.overlay(alignment: .topLeading) {
|
||||
.overlay {
|
||||
VStack(alignment: .leading, spacing: 6) {
|
||||
self.editorOverlay
|
||||
}
|
||||
.overlay(alignment: .bottom) {
|
||||
HStack(alignment: .bottom, spacing: 8) {
|
||||
self.connectionPill
|
||||
Spacer(minLength: 0)
|
||||
self.sendButton
|
||||
}
|
||||
}
|
||||
.padding(8)
|
||||
}
|
||||
.frame(minHeight: 44, idealHeight: 44, maxHeight: 96)
|
||||
|
|
@ -166,8 +166,8 @@ struct ClawdisChatComposer: View {
|
|||
if self.viewModel.input.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty {
|
||||
Text("Message Clawd…")
|
||||
.foregroundStyle(.tertiary)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 6)
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 5)
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
|
|
@ -175,17 +175,14 @@ struct ClawdisChatComposer: View {
|
|||
self.viewModel.send()
|
||||
}
|
||||
.frame(minHeight: 32, idealHeight: 32, maxHeight: 72)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 5)
|
||||
.padding(.trailing, 44)
|
||||
.padding(.bottom, 28)
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 4)
|
||||
#else
|
||||
TextEditor(text: self.$viewModel.input)
|
||||
.font(.system(size: 15))
|
||||
.scrollContentBackground(.hidden)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.vertical, 8)
|
||||
.padding(.bottom, 28)
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 6)
|
||||
.focused(self.$isFocused)
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,24 @@ public struct ClawdisChatView: View {
|
|||
@State private var showSessions = false
|
||||
private let showsSessionSwitcher: Bool
|
||||
|
||||
private enum Layout {
|
||||
#if os(macOS)
|
||||
static let outerPadding: CGFloat = 2
|
||||
static let stackSpacing: CGFloat = 3
|
||||
static let messageSpacing: CGFloat = 8
|
||||
static let messageListPaddingTop: CGFloat = 0
|
||||
static let messageListPaddingBottom: CGFloat = 2
|
||||
static let messageListPaddingHorizontal: CGFloat = 4
|
||||
#else
|
||||
static let outerPadding: CGFloat = 6
|
||||
static let stackSpacing: CGFloat = 6
|
||||
static let messageSpacing: CGFloat = 12
|
||||
static let messageListPaddingTop: CGFloat = 4
|
||||
static let messageListPaddingBottom: CGFloat = 6
|
||||
static let messageListPaddingHorizontal: CGFloat = 8
|
||||
#endif
|
||||
}
|
||||
|
||||
public init(viewModel: ClawdisChatViewModel, showsSessionSwitcher: Bool = false) {
|
||||
self._viewModel = State(initialValue: viewModel)
|
||||
self.showsSessionSwitcher = showsSessionSwitcher
|
||||
|
|
@ -17,12 +35,12 @@ public struct ClawdisChatView: View {
|
|||
ClawdisChatTheme.surface
|
||||
.ignoresSafeArea()
|
||||
|
||||
VStack(spacing: 6) {
|
||||
VStack(spacing: Layout.stackSpacing) {
|
||||
self.messageList
|
||||
ClawdisChatComposer(viewModel: self.viewModel)
|
||||
}
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 6)
|
||||
.padding(.horizontal, Layout.outerPadding)
|
||||
.padding(.vertical, Layout.outerPadding)
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .top)
|
||||
|
|
@ -39,7 +57,7 @@ public struct ClawdisChatView: View {
|
|||
private var messageList: some View {
|
||||
ScrollViewReader { proxy in
|
||||
ScrollView {
|
||||
LazyVStack(spacing: 12) {
|
||||
LazyVStack(spacing: Layout.messageSpacing) {
|
||||
ForEach(self.viewModel.messages) { msg in
|
||||
ChatMessageBubble(message: msg)
|
||||
.frame(
|
||||
|
|
@ -66,9 +84,9 @@ public struct ClawdisChatView: View {
|
|||
.frame(height: 1)
|
||||
.id(self.scrollerBottomID)
|
||||
}
|
||||
.padding(.top, 4)
|
||||
.padding(.bottom, 6)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.top, Layout.messageListPaddingTop)
|
||||
.padding(.bottom, Layout.messageListPaddingBottom)
|
||||
.padding(.horizontal, Layout.messageListPaddingHorizontal)
|
||||
}
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 16, style: .continuous)
|
||||
|
|
|
|||
Loading…
Reference in New Issue