diff --git a/LightlessSync/UI/SyncshellAdminUI.cs b/LightlessSync/UI/SyncshellAdminUI.cs index 4cf254b..ec51596 100644 --- a/LightlessSync/UI/SyncshellAdminUI.cs +++ b/LightlessSync/UI/SyncshellAdminUI.cs @@ -195,9 +195,9 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase using var table = ImRaii.Table("userList#" + GroupFullInfo.Group.GID, 3, tableFlags); if (table) { - ImGui.TableSetupColumn("Alias/UID/Note", ImGuiTableColumnFlags.None, 5); + ImGui.TableSetupColumn("Alias/UID/Note", ImGuiTableColumnFlags.None, 4); ImGui.TableSetupColumn("Flags", ImGuiTableColumnFlags.None, 1); - ImGui.TableSetupColumn("Actions", ImGuiTableColumnFlags.None, 2); + ImGui.TableSetupColumn("Actions", ImGuiTableColumnFlags.None, 3); ImGui.TableHeadersRow(); var groupedPairs = new Dictionary(pairs.Select(p => new KeyValuePair(p, @@ -254,13 +254,29 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase ImGui.TableNextColumn(); // actions if (_isOwner) { - if (_uiSharedService.IconButton(FontAwesomeIcon.UserShield)) + using (ImRaii.PushColor(ImGuiCol.Text, UIColors.Get("LightlessYellow"))) { - GroupPairUserInfo userInfo = pair.Value ?? GroupPairUserInfo.None; + if (_uiSharedService.IconButton(FontAwesomeIcon.Crown) && UiSharedService.CtrlPressed() && UiSharedService.ShiftPressed()) + { + _ = _apiController.GroupChangeOwnership(new(GroupFullInfo.Group, pair.Key.UserData)); + ImGui.CloseCurrentPopup(); + } - userInfo.SetModerator(!userInfo.IsModerator()); + } + UiSharedService.AttachToolTip("Hold CTRL and SHIFT and click to transfer ownership of this Syncshell to " + + (pair.Key.UserData.AliasOrUID) + Environment.NewLine + "WARNING: This action is irreversible and will close screen."); + ImGui.SameLine(); - _ = _apiController.GroupSetUserInfo(new GroupPairUserInfoDto(GroupFullInfo.Group, pair.Key.UserData, userInfo)); + using (ImRaii.PushColor(ImGuiCol.Text, pair.Value != null && pair.Value.Value.IsModerator() ? UIColors.Get("DimRed") : UIColors.Get("PairBlue"))) + { + if (_uiSharedService.IconButton(FontAwesomeIcon.UserShield)) + { + GroupPairUserInfo userInfo = pair.Value ?? GroupPairUserInfo.None; + + userInfo.SetModerator(!userInfo.IsModerator()); + + _ = _apiController.GroupSetUserInfo(new GroupPairUserInfoDto(GroupFullInfo.Group, pair.Key.UserData, userInfo)); + } } UiSharedService.AttachToolTip(pair.Value != null && pair.Value.Value.IsModerator() ? "Demod user" : "Mod user"); ImGui.SameLine();