Added owner icon and removed ban/kick/pin buttons for owner if he/she is in list.
This commit is contained in:
@@ -3,7 +3,6 @@ using LightlessSync.PlayerData.Pairs;
|
|||||||
using LightlessSync.Services.Mediator;
|
using LightlessSync.Services.Mediator;
|
||||||
using LightlessSync.Services.ServerConfiguration;
|
using LightlessSync.Services.ServerConfiguration;
|
||||||
using LightlessSync.UI;
|
using LightlessSync.UI;
|
||||||
using LightlessSync.UI.Components.Popup;
|
|
||||||
using LightlessSync.WebAPI;
|
using LightlessSync.WebAPI;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using Dalamud.Interface.Windowing;
|
|||||||
using LightlessSync.LightlessConfiguration;
|
using LightlessSync.LightlessConfiguration;
|
||||||
using LightlessSync.Services.Mediator;
|
using LightlessSync.Services.Mediator;
|
||||||
using LightlessSync.UI;
|
using LightlessSync.UI;
|
||||||
using LightlessSync.UI.Components.Popup;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace LightlessSync.Services;
|
namespace LightlessSync.Services;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ using LightlessSync.WebAPI;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
namespace LightlessSync.UI.Components.Popup;
|
namespace LightlessSync.UI;
|
||||||
|
|
||||||
public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
||||||
{
|
{
|
||||||
@@ -126,7 +126,9 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
using var table = ImRaii.Table("userList#" + GroupFullInfo.Group.GID, 4, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp | ImGuiTableFlags.ScrollY);
|
var tableFlags = ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp;
|
||||||
|
if (pairs.Count > 10) tableFlags |= ImGuiTableFlags.ScrollY;
|
||||||
|
using var table = ImRaii.Table("userList#" + GroupFullInfo.Group.GID, 4, tableFlags);
|
||||||
if (table)
|
if (table)
|
||||||
{
|
{
|
||||||
ImGui.TableSetupColumn("Alias/UID/Note", ImGuiTableColumnFlags.None, 3);
|
ImGui.TableSetupColumn("Alias/UID/Note", ImGuiTableColumnFlags.None, 3);
|
||||||
@@ -141,12 +143,14 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
foreach (var pair in groupedPairs.OrderBy(p =>
|
foreach (var pair in groupedPairs.OrderBy(p =>
|
||||||
{
|
{
|
||||||
if (p.Value == null) return 10;
|
if (p.Value == null) return 10;
|
||||||
if (p.Value.Value.IsModerator()) return 0;
|
if (string.Equals(p.Key.UserData.UID, GroupFullInfo.OwnerUID, StringComparison.Ordinal)) return 0;
|
||||||
if (p.Value.Value.IsPinned()) return 1;
|
if (p.Value.Value.IsModerator()) return 1;
|
||||||
|
if (p.Value.Value.IsPinned()) return 2;
|
||||||
return 10;
|
return 10;
|
||||||
}).ThenBy(p => p.Key.GetNote() ?? p.Key.UserData.AliasOrUID, StringComparer.OrdinalIgnoreCase))
|
}).ThenBy(p => p.Key.GetNote() ?? p.Key.UserData.AliasOrUID, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
using var tableId = ImRaii.PushId("userTable_" + pair.Key.UserData.UID);
|
using var tableId = ImRaii.PushId("userTable_" + pair.Key.UserData.UID);
|
||||||
|
var isUserOwner = string.Equals(pair.Key.UserData.UID, GroupFullInfo.OwnerUID, StringComparison.Ordinal);
|
||||||
|
|
||||||
ImGui.TableNextColumn(); // alias/uid/note
|
ImGui.TableNextColumn(); // alias/uid/note
|
||||||
var note = pair.Key.GetNote();
|
var note = pair.Key.GetNote();
|
||||||
@@ -165,18 +169,23 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
UiSharedService.ColorText(onlineText, boolcolor);
|
UiSharedService.ColorText(onlineText, boolcolor);
|
||||||
|
|
||||||
ImGui.TableNextColumn(); // special flags
|
ImGui.TableNextColumn(); // special flags
|
||||||
if (pair.Value != null && (pair.Value.Value.IsModerator() || pair.Value.Value.IsPinned()))
|
if (pair.Value != null && (pair.Value.Value.IsModerator() || pair.Value.Value.IsPinned() || isUserOwner))
|
||||||
{
|
{
|
||||||
if (pair.Value.Value.IsModerator())
|
if (pair.Value.Value.IsModerator())
|
||||||
{
|
{
|
||||||
_uiSharedService.IconText(FontAwesomeIcon.UserShield);
|
_uiSharedService.IconText(FontAwesomeIcon.UserShield, UIColors.Get("LightlessPurple"));
|
||||||
UiSharedService.AttachToolTip("Moderator");
|
UiSharedService.AttachToolTip("Moderator");
|
||||||
}
|
}
|
||||||
if (pair.Value.Value.IsPinned())
|
if (pair.Value.Value.IsPinned() && !isUserOwner)
|
||||||
{
|
{
|
||||||
_uiSharedService.IconText(FontAwesomeIcon.Thumbtack);
|
_uiSharedService.IconText(FontAwesomeIcon.Thumbtack);
|
||||||
UiSharedService.AttachToolTip("Pinned");
|
UiSharedService.AttachToolTip("Pinned");
|
||||||
}
|
}
|
||||||
|
if (isUserOwner)
|
||||||
|
{
|
||||||
|
_uiSharedService.IconText(FontAwesomeIcon.Crown, UIColors.Get("LightlessYellow"));
|
||||||
|
UiSharedService.AttachToolTip("Owner");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -198,7 +207,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_isOwner || (pair.Value == null || (pair.Value != null && !pair.Value.Value.IsModerator())))
|
if (pair.Value == null || pair.Value != null && !pair.Value.Value.IsModerator() && !isUserOwner)
|
||||||
{
|
{
|
||||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Thumbtack))
|
if (_uiSharedService.IconButton(FontAwesomeIcon.Thumbtack))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user