From 128a89234ea44871ae0203778e5fbdccbd5554f6 Mon Sep 17 00:00:00 2001 From: Stanley Dimant Date: Thu, 6 Oct 2022 22:42:07 +0200 Subject: [PATCH] add owner and moderator icons to syncshell display --- MareSynchronos/UI/GroupPanel.cs | 41 ++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/MareSynchronos/UI/GroupPanel.cs b/MareSynchronos/UI/GroupPanel.cs index fde812f..cc7a5fc 100644 --- a/MareSynchronos/UI/GroupPanel.cs +++ b/MareSynchronos/UI/GroupPanel.cs @@ -215,6 +215,15 @@ namespace MareSynchronos.UI ImGui.SameLine(); } + if (group.IsModerator ?? false) + { + ImGui.PushFont(UiBuilder.IconFont); + ImGui.Text(FontAwesomeIcon.UserShield.ToIconString()); + ImGui.PopFont(); + UiShared.AttachToolTip("You are a moderator of Syncshell " + groupName); + ImGui.SameLine(); + } + _showGidForEntry.TryGetValue(group.GID, out var showGidInsteadOfName); if (!showGidInsteadOfName && _configuration.GetCurrentServerGidComments().TryGetValue(group.GID, out var groupComment)) { @@ -473,8 +482,8 @@ namespace MareSynchronos.UI var textSize = ImGui.CalcTextSize(entryUID); var originalY = ImGui.GetCursorPosY(); var buttonSizes = plusButtonSize.Y; - var userIsMod = string.Equals(entry.UserUID, ownerUid, StringComparison.Ordinal); - var userIsOwner = string.Equals(entry.UserAlias, ownerUid, StringComparison.Ordinal); + var userIsMod = entry.IsModerator ?? false; + var userIsOwner = string.Equals(entryUID, ownerUid, StringComparison.Ordinal); var textPos = originalY + plusButtonSize.Y / 2 - textSize.Y / 2; ImGui.SetCursorPosY(textPos); @@ -495,7 +504,16 @@ namespace MareSynchronos.UI UiShared.AttachToolTip("You are paired with " + entryUID); } - if (entry.IsModerator ?? false) + if (userIsOwner) + { + ImGui.SameLine(); + ImGui.SetCursorPosY(textPos); + ImGui.PushFont(UiBuilder.IconFont); + ImGui.TextUnformatted(FontAwesomeIcon.Crown.ToIconString()); + ImGui.PopFont(); + UiShared.AttachToolTip("User is owner of this Syncshell"); + } + else if (userIsMod) { ImGui.SameLine(); ImGui.SetCursorPosY(textPos); @@ -504,17 +522,14 @@ namespace MareSynchronos.UI ImGui.PopFont(); UiShared.AttachToolTip("User is moderator of this Syncshell"); } - else + else if (entry.IsPinned ?? false) { - if (entry.IsPinned ?? false) - { - ImGui.SameLine(); - ImGui.SetCursorPosY(textPos); - ImGui.PushFont(UiBuilder.IconFont); - ImGui.TextUnformatted(FontAwesomeIcon.Thumbtack.ToIconString()); - ImGui.PopFont(); - UiShared.AttachToolTip("User is pinned in this Syncshell"); - } + ImGui.SameLine(); + ImGui.SetCursorPosY(textPos); + ImGui.PushFont(UiBuilder.IconFont); + ImGui.TextUnformatted(FontAwesomeIcon.Thumbtack.ToIconString()); + ImGui.PopFont(); + UiShared.AttachToolTip("User is pinned in this Syncshell"); } var textIsUid = true;