Redid syncshell admin panel with same style as settings
This commit is contained in:
@@ -63,7 +63,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
using var id = ImRaii.PushId("syncshell_admin_" + GroupFullInfo.GID);
|
using var id = ImRaii.PushId("syncshell_admin_" + GroupFullInfo.GID);
|
||||||
|
|
||||||
using (_uiSharedService.UidFont.Push())
|
using (_uiSharedService.UidFont.Push())
|
||||||
ImGui.TextUnformatted(GroupFullInfo.GroupAliasOrGID + " Administrative Panel");
|
_uiSharedService.UnderlinedBigText(GroupFullInfo.GroupAliasOrGID + " Administrative Panel", UIColors.Get("LightlessBlue"));
|
||||||
|
|
||||||
ImGui.Separator();
|
ImGui.Separator();
|
||||||
var perm = GroupFullInfo.GroupPermissions;
|
var perm = GroupFullInfo.GroupPermissions;
|
||||||
@@ -72,53 +72,117 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
if (tabbar)
|
if (tabbar)
|
||||||
{
|
{
|
||||||
var inviteTab = ImRaii.TabItem("Invites");
|
DrawInvites(perm);
|
||||||
if (inviteTab)
|
|
||||||
{
|
|
||||||
bool isInvitesDisabled = perm.IsDisableInvites();
|
|
||||||
|
|
||||||
if (_uiSharedService.IconTextButton(isInvitesDisabled ? FontAwesomeIcon.Unlock : FontAwesomeIcon.Lock,
|
DrawManagement();
|
||||||
isInvitesDisabled ? "Unlock Syncshell" : "Lock Syncshell"))
|
|
||||||
|
DrawPermission(perm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawPermission(GroupPermissions perm)
|
||||||
{
|
{
|
||||||
perm.SetDisableInvites(!isInvitesDisabled);
|
var permissionTab = ImRaii.TabItem("Permissions");
|
||||||
|
if (permissionTab)
|
||||||
|
{
|
||||||
|
bool isDisableAnimations = perm.IsPreferDisableAnimations();
|
||||||
|
bool isDisableSounds = perm.IsPreferDisableSounds();
|
||||||
|
bool isDisableVfx = perm.IsPreferDisableVFX();
|
||||||
|
|
||||||
|
ImGui.AlignTextToFramePadding();
|
||||||
|
ImGui.Text("Suggest Sound Sync");
|
||||||
|
_uiSharedService.BooleanToColoredIcon(!isDisableSounds);
|
||||||
|
ImGui.SameLine(230);
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, isDisableSounds ? UIColors.Get("PairBlue") : UIColors.Get("DimRed")))
|
||||||
|
{
|
||||||
|
if (_uiSharedService.IconTextButton(isDisableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeMute,
|
||||||
|
isDisableSounds ? "Suggest to enable sound sync" : "Suggest to disable sound sync"))
|
||||||
|
{
|
||||||
|
perm.SetPreferDisableSounds(!perm.IsPreferDisableSounds());
|
||||||
_ = _apiController.GroupChangeGroupPermissionState(new(GroupFullInfo.Group, perm));
|
_ = _apiController.GroupChangeGroupPermissionState(new(GroupFullInfo.Group, perm));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiHelpers.ScaledDummy(2f);
|
|
||||||
|
|
||||||
UiSharedService.TextWrapped("One-time invites work as single-use passwords. Use those if you do not want to distribute your Syncshell password.");
|
|
||||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Envelope, "Single one-time invite"))
|
|
||||||
{
|
|
||||||
ImGui.SetClipboardText(_apiController.GroupCreateTempInvite(new(GroupFullInfo.Group), 1).Result.FirstOrDefault() ?? string.Empty);
|
|
||||||
}
|
}
|
||||||
UiSharedService.AttachToolTip("Creates a single-use password for joining the syncshell which is valid for 24h and copies it to the clipboard.");
|
|
||||||
ImGui.InputInt("##amountofinvites", ref _multiInvites);
|
ImGui.AlignTextToFramePadding();
|
||||||
|
ImGui.Text("Suggest Animation Sync");
|
||||||
|
_uiSharedService.BooleanToColoredIcon(!isDisableAnimations);
|
||||||
|
ImGui.SameLine(230);
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, isDisableAnimations ? UIColors.Get("PairBlue") : UIColors.Get("DimRed")))
|
||||||
|
{
|
||||||
|
if (_uiSharedService.IconTextButton(isDisableAnimations ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop,
|
||||||
|
isDisableAnimations ? "Suggest to enable animation sync" : "Suggest to disable animation sync"))
|
||||||
|
{
|
||||||
|
perm.SetPreferDisableAnimations(!perm.IsPreferDisableAnimations());
|
||||||
|
_ = _apiController.GroupChangeGroupPermissionState(new(GroupFullInfo.Group, perm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.AlignTextToFramePadding();
|
||||||
|
ImGui.Text("Suggest VFX Sync");
|
||||||
|
_uiSharedService.BooleanToColoredIcon(!isDisableVfx);
|
||||||
|
ImGui.SameLine(230);
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, isDisableVfx ? UIColors.Get("PairBlue") : UIColors.Get("DimRed")))
|
||||||
|
{
|
||||||
|
if (_uiSharedService.IconTextButton(isDisableVfx ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle,
|
||||||
|
isDisableVfx ? "Suggest to enable vfx sync" : "Suggest to disable vfx sync"))
|
||||||
|
{
|
||||||
|
perm.SetPreferDisableVFX(!perm.IsPreferDisableVFX());
|
||||||
|
_ = _apiController.GroupChangeGroupPermissionState(new(GroupFullInfo.Group, perm));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UiSharedService.TextWrapped("Note: those suggested permissions will be shown to users on joining the Syncshell.");
|
||||||
|
}
|
||||||
|
permissionTab.Dispose();
|
||||||
|
|
||||||
|
if (_isOwner)
|
||||||
|
{
|
||||||
|
var ownerTab = ImRaii.TabItem("Owner Settings");
|
||||||
|
if (ownerTab)
|
||||||
|
{
|
||||||
|
ImGui.AlignTextToFramePadding();
|
||||||
|
ImGui.TextUnformatted("New Password");
|
||||||
|
var availableWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
||||||
|
var buttonSize = _uiSharedService.GetIconTextButtonSize(FontAwesomeIcon.Passport, "Change Password");
|
||||||
|
var textSize = ImGui.CalcTextSize("New Password").X;
|
||||||
|
var spacing = ImGui.GetStyle().ItemSpacing.X;
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
using (ImRaii.Disabled(_multiInvites <= 1 || _multiInvites > 100))
|
ImGui.SetNextItemWidth(availableWidth - buttonSize - textSize - spacing * 2);
|
||||||
|
ImGui.InputTextWithHint("##changepw", "Min 10 characters", ref _newPassword, 50);
|
||||||
|
ImGui.SameLine();
|
||||||
|
using (ImRaii.Disabled(_newPassword.Length < 10))
|
||||||
{
|
{
|
||||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Envelope, "Generate " + _multiInvites + " one-time invites"))
|
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Passport, "Change Password"))
|
||||||
{
|
{
|
||||||
_oneTimeInvites.AddRange(_apiController.GroupCreateTempInvite(new(GroupFullInfo.Group), _multiInvites).Result);
|
_pwChangeSuccess = _apiController.GroupChangePassword(new GroupPasswordDto(GroupFullInfo.Group, _newPassword)).Result;
|
||||||
|
_newPassword = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UiSharedService.AttachToolTip("Password requires to be at least 10 characters long. This action is irreversible.");
|
||||||
|
|
||||||
|
if (!_pwChangeSuccess)
|
||||||
|
{
|
||||||
|
UiSharedService.ColorTextWrapped("Failed to change the password. Password requires to be at least 10 characters long.", ImGuiColors.DalamudYellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Syncshell") && UiSharedService.CtrlPressed() && UiSharedService.ShiftPressed())
|
||||||
|
{
|
||||||
|
IsOpen = false;
|
||||||
|
_ = _apiController.GroupDelete(new(GroupFullInfo.Group));
|
||||||
|
}
|
||||||
|
UiSharedService.AttachToolTip("Hold CTRL and Shift and click to delete this Syncshell." + Environment.NewLine + "WARNING: this action is irreversible.");
|
||||||
|
}
|
||||||
|
ownerTab.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_oneTimeInvites.Any())
|
private void DrawManagement()
|
||||||
{
|
{
|
||||||
var invites = string.Join(Environment.NewLine, _oneTimeInvites);
|
|
||||||
ImGui.InputTextMultiline("Generated Multi Invites", ref invites, 5000, new(0, 0), ImGuiInputTextFlags.ReadOnly);
|
|
||||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Copy, "Copy Invites to clipboard"))
|
|
||||||
{
|
|
||||||
ImGui.SetClipboardText(invites);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
inviteTab.Dispose();
|
|
||||||
|
|
||||||
var mgmtTab = ImRaii.TabItem("User Management");
|
var mgmtTab = ImRaii.TabItem("User Management");
|
||||||
if (mgmtTab)
|
if (mgmtTab)
|
||||||
{
|
{
|
||||||
var userNode = ImRaii.TreeNode("User List & Administration");
|
if (_uiSharedService.MediumTreeNode("User List & Administration", UIColors.Get("LightlessPurple")))
|
||||||
if (userNode)
|
|
||||||
{
|
{
|
||||||
if (!_pairManager.GroupPairs.TryGetValue(GroupFullInfo, out var pairs))
|
if (!_pairManager.GroupPairs.TryGetValue(GroupFullInfo, out var pairs))
|
||||||
{
|
{
|
||||||
@@ -128,11 +192,10 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
{
|
{
|
||||||
var tableFlags = ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp;
|
var tableFlags = ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp;
|
||||||
if (pairs.Count > 10) tableFlags |= ImGuiTableFlags.ScrollY;
|
if (pairs.Count > 10) tableFlags |= ImGuiTableFlags.ScrollY;
|
||||||
using var table = ImRaii.Table("userList#" + GroupFullInfo.Group.GID, 4, tableFlags);
|
using var table = ImRaii.Table("userList#" + GroupFullInfo.Group.GID, 3, tableFlags);
|
||||||
if (table)
|
if (table)
|
||||||
{
|
{
|
||||||
ImGui.TableSetupColumn("Alias/UID/Note", ImGuiTableColumnFlags.None, 3);
|
ImGui.TableSetupColumn("Alias/UID/Note", ImGuiTableColumnFlags.None, 5);
|
||||||
ImGui.TableSetupColumn("Online/Name", ImGuiTableColumnFlags.None, 2);
|
|
||||||
ImGui.TableSetupColumn("Flags", ImGuiTableColumnFlags.None, 1);
|
ImGui.TableSetupColumn("Flags", ImGuiTableColumnFlags.None, 1);
|
||||||
ImGui.TableSetupColumn("Actions", ImGuiTableColumnFlags.None, 2);
|
ImGui.TableSetupColumn("Actions", ImGuiTableColumnFlags.None, 2);
|
||||||
ImGui.TableHeadersRow();
|
ImGui.TableHeadersRow();
|
||||||
@@ -156,17 +219,13 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
var note = pair.Key.GetNote();
|
var note = pair.Key.GetNote();
|
||||||
var text = note == null ? pair.Key.UserData.AliasOrUID : note + " (" + pair.Key.UserData.AliasOrUID + ")";
|
var text = note == null ? pair.Key.UserData.AliasOrUID : note + " (" + pair.Key.UserData.AliasOrUID + ")";
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGui.AlignTextToFramePadding();
|
||||||
ImGui.TextUnformatted(text);
|
var boolcolor = UiSharedService.GetBoolColor(pair.Key.IsOnline);
|
||||||
|
UiSharedService.ColorText(text, boolcolor);
|
||||||
ImGui.TableNextColumn(); // online/name
|
|
||||||
string onlineText = pair.Key.IsOnline ? "Online" : "Offline";
|
|
||||||
if (!string.IsNullOrEmpty(pair.Key.PlayerName))
|
if (!string.IsNullOrEmpty(pair.Key.PlayerName))
|
||||||
{
|
{
|
||||||
onlineText += " (" + pair.Key.PlayerName + ")";
|
UiSharedService.AttachToolTip(pair.Key.PlayerName);
|
||||||
|
ImGui.SameLine();
|
||||||
}
|
}
|
||||||
var boolcolor = UiSharedService.GetBoolColor(pair.Key.IsOnline);
|
|
||||||
ImGui.AlignTextToFramePadding();
|
|
||||||
UiSharedService.ColorText(onlineText, boolcolor);
|
|
||||||
|
|
||||||
ImGui.TableNextColumn(); // special flags
|
ImGui.TableNextColumn(); // special flags
|
||||||
if (pair.Value != null && (pair.Value.Value.IsModerator() || pair.Value.Value.IsPinned() || isUserOwner))
|
if (pair.Value != null && (pair.Value.Value.IsModerator() || pair.Value.Value.IsPinned() || isUserOwner))
|
||||||
@@ -208,6 +267,8 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pair.Value == null || pair.Value != null && !pair.Value.Value.IsModerator() && !isUserOwner)
|
if (pair.Value == null || pair.Value != null && !pair.Value.Value.IsModerator() && !isUserOwner)
|
||||||
|
{
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, pair.Value != null && pair.Value.Value.IsPinned() ? UIColors.Get("DimRed") : UIColors.Get("PairBlue")))
|
||||||
{
|
{
|
||||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Thumbtack))
|
if (_uiSharedService.IconButton(FontAwesomeIcon.Thumbtack))
|
||||||
{
|
{
|
||||||
@@ -217,9 +278,12 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
|
|
||||||
_ = _apiController.GroupSetUserInfo(new GroupPairUserInfoDto(GroupFullInfo.Group, pair.Key.UserData, userInfo));
|
_ = _apiController.GroupSetUserInfo(new GroupPairUserInfoDto(GroupFullInfo.Group, pair.Key.UserData, userInfo));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
UiSharedService.AttachToolTip(pair.Value != null && pair.Value.Value.IsPinned() ? "Unpin user" : "Pin user");
|
UiSharedService.AttachToolTip(pair.Value != null && pair.Value.Value.IsPinned() ? "Unpin user" : "Pin user");
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, UIColors.Get("DimRed")))
|
||||||
|
{
|
||||||
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
||||||
{
|
{
|
||||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Trash))
|
if (_uiSharedService.IconButton(FontAwesomeIcon.Trash))
|
||||||
@@ -227,10 +291,13 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
_ = _apiController.GroupRemoveUser(new GroupPairDto(GroupFullInfo.Group, pair.Key.UserData));
|
_ = _apiController.GroupRemoveUser(new GroupPairDto(GroupFullInfo.Group, pair.Key.UserData));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
UiSharedService.AttachToolTip("Remove user from Syncshell"
|
UiSharedService.AttachToolTip("Remove user from Syncshell"
|
||||||
+ UiSharedService.TooltipSeparator + "Hold CTRL to enable this button");
|
+ UiSharedService.TooltipSeparator + "Hold CTRL to enable this button");
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
|
|
||||||
|
using (ImRaii.PushColor(ImGuiCol.Text, UIColors.Get("DimRed")))
|
||||||
|
{
|
||||||
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
||||||
{
|
{
|
||||||
if (_uiSharedService.IconButton(FontAwesomeIcon.Ban))
|
if (_uiSharedService.IconButton(FontAwesomeIcon.Ban))
|
||||||
@@ -238,16 +305,19 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
Mediator.Publish(new OpenBanUserPopupMessage(pair.Key, GroupFullInfo));
|
Mediator.Publish(new OpenBanUserPopupMessage(pair.Key, GroupFullInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
UiSharedService.AttachToolTip("Ban user from Syncshell"
|
UiSharedService.AttachToolTip("Ban user from Syncshell"
|
||||||
+ UiSharedService.TooltipSeparator + "Hold CTRL to enable this button");
|
+ UiSharedService.TooltipSeparator + "Hold CTRL to enable this button");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_uiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
|
||||||
|
ImGui.TreePop();
|
||||||
}
|
}
|
||||||
userNode.Dispose();
|
ImGui.Separator();
|
||||||
var clearNode = ImRaii.TreeNode("Mass Cleanup");
|
|
||||||
if (clearNode)
|
if (_uiSharedService.MediumTreeNode("Mass Cleanup", UIColors.Get("LightlessPurple")))
|
||||||
{
|
{
|
||||||
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
using (ImRaii.Disabled(!UiSharedService.CtrlPressed()))
|
||||||
{
|
{
|
||||||
@@ -321,18 +391,20 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
UiSharedService.TextWrapped($"Syncshell was pruned and {_pruneTask.Result} inactive user(s) have been removed.");
|
UiSharedService.TextWrapped($"Syncshell was pruned and {_pruneTask.Result} inactive user(s) have been removed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_uiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
|
||||||
|
ImGui.TreePop();
|
||||||
}
|
}
|
||||||
clearNode.Dispose();
|
ImGui.Separator();
|
||||||
|
|
||||||
var banNode = ImRaii.TreeNode("User Bans");
|
if (_uiSharedService.MediumTreeNode("User Bans", UIColors.Get("LightlessPurple")))
|
||||||
if (banNode)
|
|
||||||
{
|
{
|
||||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Retweet, "Refresh Banlist from Server"))
|
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Retweet, "Refresh Banlist from Server"))
|
||||||
{
|
{
|
||||||
_bannedUsers = _apiController.GroupGetBannedUsers(new GroupDto(GroupFullInfo.Group)).Result;
|
_bannedUsers = _apiController.GroupGetBannedUsers(new GroupDto(GroupFullInfo.Group)).Result;
|
||||||
}
|
}
|
||||||
|
var tableFlags = ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp;
|
||||||
if (ImGui.BeginTable("bannedusertable" + GroupFullInfo.GID, 6, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingStretchProp | ImGuiTableFlags.ScrollY))
|
if (_bannedUsers.Count > 10) tableFlags |= ImGuiTableFlags.ScrollY;
|
||||||
|
if (ImGui.BeginTable("bannedusertable" + GroupFullInfo.GID, 6, tableFlags))
|
||||||
{
|
{
|
||||||
ImGui.TableSetupColumn("UID", ImGuiTableColumnFlags.None, 1);
|
ImGui.TableSetupColumn("UID", ImGuiTableColumnFlags.None, 1);
|
||||||
ImGui.TableSetupColumn("Alias", ImGuiTableColumnFlags.None, 1);
|
ImGui.TableSetupColumn("Alias", ImGuiTableColumnFlags.None, 1);
|
||||||
@@ -363,100 +435,61 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
|
|||||||
_bannedUsers.RemoveAll(b => string.Equals(b.UID, bannedUser.UID, StringComparison.Ordinal));
|
_bannedUsers.RemoveAll(b => string.Equals(b.UID, bannedUser.UID, StringComparison.Ordinal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.EndTable();
|
ImGui.EndTable();
|
||||||
}
|
}
|
||||||
|
_uiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
|
||||||
|
ImGui.TreePop();
|
||||||
}
|
}
|
||||||
banNode.Dispose();
|
ImGui.Separator();
|
||||||
}
|
}
|
||||||
mgmtTab.Dispose();
|
mgmtTab.Dispose();
|
||||||
|
|
||||||
var permissionTab = ImRaii.TabItem("Permissions");
|
}
|
||||||
if (permissionTab)
|
|
||||||
{
|
|
||||||
bool isDisableAnimations = perm.IsPreferDisableAnimations();
|
|
||||||
bool isDisableSounds = perm.IsPreferDisableSounds();
|
|
||||||
bool isDisableVfx = perm.IsPreferDisableVFX();
|
|
||||||
|
|
||||||
ImGui.AlignTextToFramePadding();
|
private void DrawInvites(GroupPermissions perm)
|
||||||
ImGui.Text("Suggest Sound Sync");
|
|
||||||
_uiSharedService.BooleanToColoredIcon(!isDisableSounds);
|
|
||||||
ImGui.SameLine(230);
|
|
||||||
if (_uiSharedService.IconTextButton(isDisableSounds ? FontAwesomeIcon.VolumeUp : FontAwesomeIcon.VolumeMute,
|
|
||||||
isDisableSounds ? "Suggest to enable sound sync" : "Suggest to disable sound sync"))
|
|
||||||
{
|
{
|
||||||
perm.SetPreferDisableSounds(!perm.IsPreferDisableSounds());
|
var inviteTab = ImRaii.TabItem("Invites");
|
||||||
|
if (inviteTab)
|
||||||
|
{
|
||||||
|
bool isInvitesDisabled = perm.IsDisableInvites();
|
||||||
|
|
||||||
|
if (_uiSharedService.IconTextButton(isInvitesDisabled ? FontAwesomeIcon.Unlock : FontAwesomeIcon.Lock,
|
||||||
|
isInvitesDisabled ? "Unlock Syncshell" : "Lock Syncshell"))
|
||||||
|
{
|
||||||
|
perm.SetDisableInvites(!isInvitesDisabled);
|
||||||
_ = _apiController.GroupChangeGroupPermissionState(new(GroupFullInfo.Group, perm));
|
_ = _apiController.GroupChangeGroupPermissionState(new(GroupFullInfo.Group, perm));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGuiHelpers.ScaledDummy(2f);
|
||||||
ImGui.Text("Suggest Animation Sync");
|
|
||||||
_uiSharedService.BooleanToColoredIcon(!isDisableAnimations);
|
UiSharedService.TextWrapped("One-time invites work as single-use passwords. Use those if you do not want to distribute your Syncshell password.");
|
||||||
ImGui.SameLine(230);
|
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Envelope, "Single one-time invite"))
|
||||||
if (_uiSharedService.IconTextButton(isDisableAnimations ? FontAwesomeIcon.Running : FontAwesomeIcon.Stop,
|
|
||||||
isDisableAnimations ? "Suggest to enable animation sync" : "Suggest to disable animation sync"))
|
|
||||||
{
|
{
|
||||||
perm.SetPreferDisableAnimations(!perm.IsPreferDisableAnimations());
|
ImGui.SetClipboardText(_apiController.GroupCreateTempInvite(new(GroupFullInfo.Group), 1).Result.FirstOrDefault() ?? string.Empty);
|
||||||
_ = _apiController.GroupChangeGroupPermissionState(new(GroupFullInfo.Group, perm));
|
|
||||||
}
|
}
|
||||||
|
UiSharedService.AttachToolTip("Creates a single-use password for joining the syncshell which is valid for 24h and copies it to the clipboard.");
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGui.InputInt("##amountofinvites", ref _multiInvites);
|
||||||
ImGui.Text("Suggest VFX Sync");
|
|
||||||
_uiSharedService.BooleanToColoredIcon(!isDisableVfx);
|
|
||||||
ImGui.SameLine(230);
|
|
||||||
if (_uiSharedService.IconTextButton(isDisableVfx ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle,
|
|
||||||
isDisableVfx ? "Suggest to enable vfx sync" : "Suggest to disable vfx sync"))
|
|
||||||
{
|
|
||||||
perm.SetPreferDisableVFX(!perm.IsPreferDisableVFX());
|
|
||||||
_ = _apiController.GroupChangeGroupPermissionState(new(GroupFullInfo.Group, perm));
|
|
||||||
}
|
|
||||||
|
|
||||||
UiSharedService.TextWrapped("Note: those suggested permissions will be shown to users on joining the Syncshell.");
|
|
||||||
}
|
|
||||||
permissionTab.Dispose();
|
|
||||||
|
|
||||||
if (_isOwner)
|
|
||||||
{
|
|
||||||
var ownerTab = ImRaii.TabItem("Owner Settings");
|
|
||||||
if (ownerTab)
|
|
||||||
{
|
|
||||||
ImGui.AlignTextToFramePadding();
|
|
||||||
ImGui.TextUnformatted("New Password");
|
|
||||||
var availableWidth = ImGui.GetWindowContentRegionMax().X - ImGui.GetWindowContentRegionMin().X;
|
|
||||||
var buttonSize = _uiSharedService.GetIconTextButtonSize(FontAwesomeIcon.Passport, "Change Password");
|
|
||||||
var textSize = ImGui.CalcTextSize("New Password").X;
|
|
||||||
var spacing = ImGui.GetStyle().ItemSpacing.X;
|
|
||||||
|
|
||||||
ImGui.SameLine();
|
ImGui.SameLine();
|
||||||
ImGui.SetNextItemWidth(availableWidth - buttonSize - textSize - spacing * 2);
|
using (ImRaii.Disabled(_multiInvites <= 1 || _multiInvites > 100))
|
||||||
ImGui.InputTextWithHint("##changepw", "Min 10 characters", ref _newPassword, 50);
|
|
||||||
ImGui.SameLine();
|
|
||||||
using (ImRaii.Disabled(_newPassword.Length < 10))
|
|
||||||
{
|
{
|
||||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Passport, "Change Password"))
|
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Envelope, "Generate " + _multiInvites + " one-time invites"))
|
||||||
{
|
{
|
||||||
_pwChangeSuccess = _apiController.GroupChangePassword(new GroupPasswordDto(GroupFullInfo.Group, _newPassword)).Result;
|
_oneTimeInvites.AddRange(_apiController.GroupCreateTempInvite(new(GroupFullInfo.Group), _multiInvites).Result);
|
||||||
_newPassword = string.Empty;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UiSharedService.AttachToolTip("Password requires to be at least 10 characters long. This action is irreversible.");
|
|
||||||
|
|
||||||
if (!_pwChangeSuccess)
|
|
||||||
{
|
|
||||||
UiSharedService.ColorTextWrapped("Failed to change the password. Password requires to be at least 10 characters long.", ImGuiColors.DalamudYellow);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Syncshell") && UiSharedService.CtrlPressed() && UiSharedService.ShiftPressed())
|
if (_oneTimeInvites.Any())
|
||||||
{
|
{
|
||||||
IsOpen = false;
|
var invites = string.Join(Environment.NewLine, _oneTimeInvites);
|
||||||
_ = _apiController.GroupDelete(new(GroupFullInfo.Group));
|
ImGui.InputTextMultiline("Generated Multi Invites", ref invites, 5000, new(0, 0), ImGuiInputTextFlags.ReadOnly);
|
||||||
}
|
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Copy, "Copy Invites to clipboard"))
|
||||||
UiSharedService.AttachToolTip("Hold CTRL and Shift and click to delete this Syncshell." + Environment.NewLine + "WARNING: this action is irreversible.");
|
{
|
||||||
}
|
ImGui.SetClipboardText(invites);
|
||||||
ownerTab.Dispose();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
inviteTab.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
public override void OnClose()
|
public override void OnClose()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user