ios: right-align user bubbles on iPad #7
@@ -25,6 +25,7 @@ struct SybilChatTranscriptView: View {
|
|||||||
|
|
||||||
ForEach(messages) { message in
|
ForEach(messages) { message in
|
||||||
MessageBubble(message: message, isSending: isSending)
|
MessageBubble(message: message, isSending: isSending)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
.id(message.id)
|
.id(message.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,10 +87,8 @@ private struct MessageBubble: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
HStack(alignment: .top) {
|
HStack(alignment: .top, spacing: 0) {
|
||||||
if isUser {
|
leadingSpacer
|
||||||
Spacer(minLength: 44)
|
|
||||||
}
|
|
||||||
|
|
||||||
if let toolCallMetadata {
|
if let toolCallMetadata {
|
||||||
ToolCallActivityChip(
|
ToolCallActivityChip(
|
||||||
@@ -136,12 +135,24 @@ private struct MessageBubble: View {
|
|||||||
.frame(maxWidth: isUser ? 420 : nil, alignment: isUser ? .trailing : .leading)
|
.frame(maxWidth: isUser ? 420 : nil, alignment: isUser ? .trailing : .leading)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trailingSpacer
|
||||||
|
}
|
||||||
|
.frame(maxWidth: .infinity, alignment: isUser ? .trailing : .leading)
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var leadingSpacer: some View {
|
||||||
|
if isUser {
|
||||||
|
Spacer(minLength: 44)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var trailingSpacer: some View {
|
||||||
if !isUser {
|
if !isUser {
|
||||||
Spacer(minLength: 0)
|
Spacer(minLength: 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: isUser ? .trailing : .leading)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct ToolCallActivityChip: View {
|
private struct ToolCallActivityChip: View {
|
||||||
|
|||||||
Reference in New Issue
Block a user