diff --git a/MareSynchronos/UI/Components/DrawUserPair.cs b/MareSynchronos/UI/Components/DrawUserPair.cs index 6f05ad4..5869f4e 100644 --- a/MareSynchronos/UI/Components/DrawUserPair.cs +++ b/MareSynchronos/UI/Components/DrawUserPair.cs @@ -21,6 +21,7 @@ public class DrawUserPair protected readonly IdDisplayHandler _displayHandler; protected readonly MareMediator _mediator; protected readonly List _syncedGroups; + private readonly GroupFullInfoDto? _currentGroup; protected Pair _pair; private readonly string _id; private readonly SelectTagForPairUi _selectTagForPairUi; @@ -28,6 +29,7 @@ public class DrawUserPair private float _menuRenderWidth = -1; public DrawUserPair(string id, Pair entry, List syncedGroups, + GroupFullInfoDto? currentGroup, ApiController apiController, IdDisplayHandler uIDDisplayHandler, MareMediator mareMediator, SelectTagForPairUi selectTagForPairUi, ServerConfigurationManager serverConfigurationManager) @@ -35,6 +37,7 @@ public class DrawUserPair _id = id; _pair = entry; _syncedGroups = syncedGroups; + _currentGroup = currentGroup; _apiController = apiController; _displayHandler = uIDDisplayHandler; _mediator = mareMediator; @@ -233,6 +236,41 @@ public class DrawUserPair } UiSharedService.AttachToolTip(userPairText); + if (_currentGroup != null) + { + ImGui.AlignTextToFramePadding(); + if (string.Equals(_currentGroup.OwnerUID, _pair.UserData.UID, StringComparison.Ordinal)) + { + using (ImRaii.PushFont(UiBuilder.IconFont)) + { + ImGui.SameLine(); + ImGui.TextUnformatted(FontAwesomeIcon.Crown.ToIconString()); + } + UiSharedService.AttachToolTip("User is owner of this syncshell"); + } + else if (_currentGroup.GroupPairUserInfos.TryGetValue(_pair.UserData.UID, out var userinfo)) + { + if (userinfo.IsModerator()) + { + using (ImRaii.PushFont(UiBuilder.IconFont)) + { + ImGui.SameLine(); + ImGui.TextUnformatted(FontAwesomeIcon.UserShield.ToIconString()); + } + UiSharedService.AttachToolTip("User is moderator in this syncshell"); + } + else if (userinfo.IsPinned()) + { + using (ImRaii.PushFont(UiBuilder.IconFont)) + { + ImGui.SameLine(); + ImGui.TextUnformatted(FontAwesomeIcon.Thumbtack.ToIconString()); + } + UiSharedService.AttachToolTip("User is pinned in this syncshell"); + } + } + } + if (_pair.UserPair.OwnPermissions.IsSticky()) { ImGui.AlignTextToFramePadding(); diff --git a/MareSynchronos/UI/DrawEntityFactory.cs b/MareSynchronos/UI/DrawEntityFactory.cs index 3e7ecdd..67f6793 100644 --- a/MareSynchronos/UI/DrawEntityFactory.cs +++ b/MareSynchronos/UI/DrawEntityFactory.cs @@ -41,7 +41,7 @@ public class DrawEntityFactory IImmutableList allPairs) { return new DrawFolderGroup(groupFullInfoDto.Group.GID, groupFullInfoDto, _apiController, - filteredPairs.Select(p => CreateDrawPair(groupFullInfoDto.Group.GID + p.Key.UserData.UID, p.Key, p.Value)).ToImmutableList(), + filteredPairs.Select(p => CreateDrawPair(groupFullInfoDto.Group.GID + p.Key.UserData.UID, p.Key, p.Value, groupFullInfoDto)).ToImmutableList(), allPairs, _tagHandler, _uidDisplayHandler, _mediator); } @@ -49,13 +49,13 @@ public class DrawEntityFactory Dictionary> filteredPairs, IImmutableList allPairs) { - return new(tag, filteredPairs.Select(u => CreateDrawPair(tag, u.Key, u.Value)).ToImmutableList(), + return new(tag, filteredPairs.Select(u => CreateDrawPair(tag, u.Key, u.Value, null)).ToImmutableList(), allPairs, _tagHandler, _apiController, _selectPairForTagUi); } - public DrawUserPair CreateDrawPair(string id, Pair user, List groups) + public DrawUserPair CreateDrawPair(string id, Pair user, List groups, GroupFullInfoDto? currentGroup) { - return new DrawUserPair(id + user.UserData.UID, user, groups, _apiController, _uidDisplayHandler, + return new DrawUserPair(id + user.UserData.UID, user, groups, currentGroup, _apiController, _uidDisplayHandler, _mediator, _selectTagForPairUi, _serverConfigurationManager); } } \ No newline at end of file