diff --git a/yobble/Views/Chat/PrivateChatView.swift b/yobble/Views/Chat/PrivateChatView.swift index 07df416..85221de 100644 --- a/yobble/Views/Chat/PrivateChatView.swift +++ b/yobble/Views/Chat/PrivateChatView.swift @@ -270,28 +270,29 @@ struct PrivateChatView: View { let bubbleColor = isCurrentUser ? Color.accentColor : Color(.secondarySystemBackground) let foregroundColor = isCurrentUser ? Color.white : Color.primary - return VStack(alignment: isCurrentUser ? .trailing : .leading, spacing: 4) { - // Message Text - HStack{ + // Use a single HStack with bottom alignment to keep text and time on the same line, + // with the time aligning to the bottom. + return HStack(alignment: .bottom, spacing: 8) { Text(contentText(for: message)) .font(.body) .foregroundColor(foregroundColor) - .multilineTextAlignment(.leading) // Keep text left-aligned within its frame - - // Timestamp and Read Status + .multilineTextAlignment(.leading) + + // This view contains the time and the optional checkmark. + // It's pushed to the right by the expanding Text view. HStack(spacing: 4) { - // NO Spacer here. The parent VStack's alignment handles positioning. Text(timeText) .font(.caption2) .foregroundColor(isCurrentUser ? foregroundColor.opacity(0.85) : .secondary) - + if isCurrentUser { - Image(systemName: (message.isViewed ?? false) ? "checkmark.checkmark" : "checkmark") + Image(systemName: (message.isViewed ?? false) ? "checkmark.circle.fill" : "checkmark.circle") .font(.system(size: 12, weight: .semibold)) .foregroundColor(isCurrentUser ? foregroundColor.opacity(0.85) : .secondary) } } - } + // Lower the timestamp slightly to make it look like it's in the corner. + .padding(.bottom, 2) } .padding(.vertical, 10) .padding(.horizontal, 12)