Bold user's own nickname in chat messages

- Added font weight logic to formatMessageAsText and formatMessage
- User's own @nickname appears bold (weight: .bold)
- Other nicknames remain medium weight
- Helps visually distinguish own messages from others
This commit is contained in:
jack
2025-07-24 13:18:12 +02:00
parent b51000939b
commit 58876704c3
+6 -2
View File
@@ -983,7 +983,9 @@ class ChatViewModel: ObservableObject {
// Use consistent color for all senders // Use consistent color for all senders
senderStyle.foregroundColor = primaryColor senderStyle.foregroundColor = primaryColor
senderStyle.font = .system(size: 14, weight: .medium, design: .monospaced) // Bold the user's own nickname
let fontWeight: Font.Weight = message.sender == nickname ? .bold : .medium
senderStyle.font = .system(size: 14, weight: fontWeight, design: .monospaced)
result.append(sender.mergingAttributes(senderStyle)) result.append(sender.mergingAttributes(senderStyle))
// Process content with hashtags and mentions // Process content with hashtags and mentions
@@ -1104,7 +1106,9 @@ class ChatViewModel: ObservableObject {
// Use consistent color for all senders // Use consistent color for all senders
senderStyle.foregroundColor = primaryColor senderStyle.foregroundColor = primaryColor
senderStyle.font = .system(size: 12, weight: .medium, design: .monospaced) // Bold the user's own nickname
let fontWeight: Font.Weight = message.sender == nickname ? .bold : .medium
senderStyle.font = .system(size: 12, weight: fontWeight, design: .monospaced)
result.append(sender.mergingAttributes(senderStyle)) result.append(sender.mergingAttributes(senderStyle))