add owner/moderator/pinned user icons
This commit is contained in:
@@ -21,6 +21,7 @@ public class DrawUserPair
|
||||
protected readonly IdDisplayHandler _displayHandler;
|
||||
protected readonly MareMediator _mediator;
|
||||
protected readonly List<GroupFullInfoDto> _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<GroupFullInfoDto> 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();
|
||||
|
||||
@@ -41,7 +41,7 @@ public class DrawEntityFactory
|
||||
IImmutableList<Pair> 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<Pair, List<GroupFullInfoDto>> filteredPairs,
|
||||
IImmutableList<Pair> 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<GroupFullInfoDto> groups)
|
||||
public DrawUserPair CreateDrawPair(string id, Pair user, List<GroupFullInfoDto> 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user