refactor(shared): dedupe common OpenClawKit helpers

This commit is contained in:
Peter Steinberger
2026-03-02 11:31:57 +00:00
parent 3dd01c3361
commit 2ca5722221
22 changed files with 685 additions and 129 deletions

View File

@@ -488,6 +488,20 @@ extension ChatTypingIndicatorBubble: @MainActor Equatable {
}
}
private extension View {
func assistantBubbleContainerStyle() -> some View {
self
.background(
RoundedRectangle(cornerRadius: 16, style: .continuous)
.fill(OpenClawChatTheme.assistantBubble))
.overlay(
RoundedRectangle(cornerRadius: 16, style: .continuous)
.strokeBorder(Color.white.opacity(0.08), lineWidth: 1))
.frame(maxWidth: ChatUIConstants.bubbleMaxWidth, alignment: .leading)
.focusable(false)
}
}
@MainActor
struct ChatStreamingAssistantBubble: View {
let text: String
@@ -498,14 +512,7 @@ struct ChatStreamingAssistantBubble: View {
ChatAssistantTextBody(text: self.text, markdownVariant: self.markdownVariant)
}
.padding(12)
.background(
RoundedRectangle(cornerRadius: 16, style: .continuous)
.fill(OpenClawChatTheme.assistantBubble))
.overlay(
RoundedRectangle(cornerRadius: 16, style: .continuous)
.strokeBorder(Color.white.opacity(0.08), lineWidth: 1))
.frame(maxWidth: ChatUIConstants.bubbleMaxWidth, alignment: .leading)
.focusable(false)
.assistantBubbleContainerStyle()
}
}
@@ -542,14 +549,7 @@ struct ChatPendingToolsBubble: View {
}
}
.padding(12)
.background(
RoundedRectangle(cornerRadius: 16, style: .continuous)
.fill(OpenClawChatTheme.assistantBubble))
.overlay(
RoundedRectangle(cornerRadius: 16, style: .continuous)
.strokeBorder(Color.white.opacity(0.08), lineWidth: 1))
.frame(maxWidth: ChatUIConstants.bubbleMaxWidth, alignment: .leading)
.focusable(false)
.assistantBubbleContainerStyle()
}
}