@@ -498,39 +498,30 @@ struct MessageBubble: View {
498498 @Environment ( \. colorScheme) private var colorScheme
499499
500500 var body : some View {
501- HStack {
502- if message. sender == . user {
503- Spacer ( minLength: 60 )
501+ VStack ( alignment: message. sender == . user ? . trailing : . leading, spacing: 4 ) {
502+ if message. type == . toolApprovalRequest {
503+ toolApprovalView
504+ } else if message. type == . thought {
505+ thoughtBubbleView
506+ } else if message. type == . toolStatus {
507+ toolStatusBubbleView
508+ } else if message. type == . slashCommand {
509+ slashCommandBubbleView
510+ } else {
511+ textBubbleView
504512 }
505-
506- VStack ( alignment: message. sender == . user ? . trailing : . leading, spacing: 4 ) {
507- if message. type == . toolApprovalRequest {
508- toolApprovalView
509- } else if message. type == . thought {
510- thoughtBubbleView
511- } else if message. type == . toolStatus {
512- toolStatusBubbleView
513- } else if message. type == . slashCommand {
514- slashCommandBubbleView
515- } else {
516- textBubbleView
517- }
518-
519- HStack ( spacing: 4 ) {
520- Text ( timeString)
521- . font ( . caption2)
522- . foregroundColor ( . secondary)
523-
524- if message. sender == . user {
525- statusIcon
526- }
513+
514+ HStack ( spacing: 4 ) {
515+ Text ( timeString)
516+ . font ( . caption2)
517+ . foregroundColor ( . secondary)
518+
519+ if message. sender == . user {
520+ statusIcon
527521 }
528522 }
529-
530- if message. sender == . agent {
531- Spacer ( minLength: 60 )
532- }
533523 }
524+ . frame ( maxWidth: . infinity, alignment: message. sender == . user ? . trailing : . leading)
534525 }
535526
536527 @ViewBuilder
@@ -558,6 +549,7 @@ struct MessageBubble: View {
558549 . markdownCodeSyntaxHighlighter ( . splashAdapting( to: colorScheme) )
559550 }
560551 }
552+ . frame ( maxWidth: . infinity, alignment: . leading)
561553 . padding ( 12 )
562554 . background ( backgroundColor)
563555 . foregroundColor ( textColor)
@@ -600,25 +592,27 @@ struct MessageBubble: View {
600592 . font ( . subheadline)
601593 . italic ( )
602594 }
595+ . frame ( maxWidth: . infinity, alignment: . leading)
603596 . padding ( 10 )
604597 . background ( Color . purple. opacity ( 0.1 ) )
605598 . foregroundColor ( . purple)
606599 . cornerRadius ( 12 )
607600 }
608-
601+
609602 @ViewBuilder
610603 private var toolStatusBubbleView : some View {
611604 HStack ( spacing: 8 ) {
612605 Image ( systemName: " gear " )
613606 Text ( message. text)
614607 . font ( . subheadline)
615608 }
609+ . frame ( maxWidth: . infinity, alignment: . leading)
616610 . padding ( 10 )
617611 . background ( Color . blue. opacity ( 0.1 ) )
618612 . foregroundColor ( . blue)
619613 . cornerRadius ( 12 )
620614 }
621-
615+
622616 @ViewBuilder
623617 private var toolApprovalView : some View {
624618 VStack ( alignment: . leading, spacing: 12 ) {
@@ -703,6 +697,7 @@ struct MessageBubble: View {
703697 . cornerRadius ( 8 )
704698 }
705699 }
700+ . frame ( maxWidth: . infinity, alignment: . leading)
706701 . padding ( 12 )
707702 . background ( Color . orange. opacity ( 0.05 ) )
708703 . cornerRadius ( 16 )
0 commit comments