mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
fix: improve role tag formatting and handle empty role cases in user status display
This commit is contained in:
@@ -39,6 +39,10 @@ public static partial class ChatColors
|
|||||||
lastIndex = match.Index + match.Length;
|
lastIndex = match.Index + match.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add remaining text after the last mention (or all text if no mentions found)
|
||||||
|
if (lastIndex < text.Length)
|
||||||
|
segments.Add(new ChatSegment(text[lastIndex..], defaultColor));
|
||||||
|
|
||||||
// Second pass: highlight #channels in non-mention segments
|
// Second pass: highlight #channels in non-mention segments
|
||||||
var mentionSegments = segments;
|
var mentionSegments = segments;
|
||||||
segments = [];
|
segments = [];
|
||||||
|
|||||||
@@ -923,12 +923,14 @@ public sealed partial class MainWindow : Runnable
|
|||||||
var name = u.DisplayName ?? u.Username;
|
var name = u.DisplayName ?? u.Username;
|
||||||
var roleTag = u.Role switch
|
var roleTag = u.Role switch
|
||||||
{
|
{
|
||||||
ServerRole.Owner => "\u2605 ", // ★
|
ServerRole.Owner => "\u2605", // ★
|
||||||
ServerRole.Admin => "\u2666 ", // ♦
|
ServerRole.Admin => "\u2666", // ♦
|
||||||
ServerRole.Mod => "\u2740 ", // ❀
|
ServerRole.Mod => "\u2740", // ❀
|
||||||
_ => ""
|
_ => ""
|
||||||
};
|
};
|
||||||
var text = $"{statusIcon} {roleTag} {name}";
|
var text = roleTag.Length > 0
|
||||||
|
? $"{statusIcon} {roleTag} {name}"
|
||||||
|
: $"{statusIcon} {name}";
|
||||||
var nameColor = HexColorHelper.ParseHexColor(u.NicknameColor);
|
var nameColor = HexColorHelper.ParseHexColor(u.NicknameColor);
|
||||||
return (text, nameColor, u.Username);
|
return (text, nameColor, u.Username);
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|||||||
Reference in New Issue
Block a user