Changed syncshell profiles a bit.

This commit is contained in:
CakeAndBanana
2025-10-12 22:49:50 +02:00
parent be847c16b8
commit b43ceb9f7e
2 changed files with 164 additions and 143 deletions

File diff suppressed because one or more lines are too long

View File

@@ -32,6 +32,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
private readonly LightlessProfileManager _lightlessProfileManager; private readonly LightlessProfileManager _lightlessProfileManager;
private readonly FileDialogManager _fileDialogManager; private readonly FileDialogManager _fileDialogManager;
private readonly UiSharedService _uiSharedService; private readonly UiSharedService _uiSharedService;
private LightlessGroupProfileData _profileData = null;
private List<BannedGroupUserDto> _bannedUsers = []; private List<BannedGroupUserDto> _bannedUsers = [];
private bool _adjustedForScollBarsLocalProfile = false; private bool _adjustedForScollBarsLocalProfile = false;
private bool _adjustedForScollBarsOnlineProfile = false; private bool _adjustedForScollBarsOnlineProfile = false;
@@ -80,7 +81,6 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
GroupFullInfo = _pairManager.Groups[GroupFullInfo.Group]; GroupFullInfo = _pairManager.Groups[GroupFullInfo.Group];
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())
_uiSharedService.UnderlinedBigText(GroupFullInfo.GroupAliasOrGID + " Administrative Panel", UIColors.Get("LightlessBlue")); _uiSharedService.UnderlinedBigText(GroupFullInfo.GroupAliasOrGID + " Administrative Panel", UIColors.Get("LightlessBlue"));
@@ -199,24 +199,28 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
} }
private void DrawProfile() private void DrawProfile()
{ {
var profile = _lightlessProfileManager.GetLightlessGroupProfile(new GroupData(GroupFullInfo.Group.GID));
var profileTab = ImRaii.TabItem("Profile"); var profileTab = ImRaii.TabItem("Profile");
if (profileTab) if (profileTab)
{ {
_uiSharedService.MediumText("Current Profile (as saved on server)", UIColors.Get("LightlessPurple")); if (_uiSharedService.MediumTreeNode("Current Profile", UIColors.Get("LightlessPurple")))
{
_logger.LogInformation(GroupFullInfo.Group.GID);
_profileData = _lightlessProfileManager.GetLightlessGroupProfile(GroupFullInfo.Group);
if (_profileData != null)
{
ImGui.Dummy(new Vector2(5)); ImGui.Dummy(new Vector2(5));
if (!_profileImage.SequenceEqual(profile.ImageData.Value)) if (!_profileImage.SequenceEqual(_profileData.ImageData.Value))
{ {
_profileImage = profile.ImageData.Value; _profileImage = _profileData.ImageData.Value;
_pfpTextureWrap?.Dispose(); _pfpTextureWrap?.Dispose();
_pfpTextureWrap = _uiSharedService.LoadImage(_profileImage); _pfpTextureWrap = _uiSharedService.LoadImage(_profileImage);
} }
if (!string.Equals(_profileDescription, profile.Description, StringComparison.OrdinalIgnoreCase)) if (!string.Equals(_profileDescription, _profileData.Description, StringComparison.OrdinalIgnoreCase))
{ {
_profileDescription = profile.Description; _profileDescription = _profileData.Description;
_descriptionText = _profileDescription; _descriptionText = _profileDescription;
} }
@@ -229,7 +233,7 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
ImGuiHelpers.ScaledRelativeSameLine(256, spacing); ImGuiHelpers.ScaledRelativeSameLine(256, spacing);
using (_uiSharedService.GameFont.Push()) using (_uiSharedService.GameFont.Push())
{ {
var descriptionTextSize = ImGui.CalcTextSize(profile.Description, wrapWidth: 256f); var descriptionTextSize = ImGui.CalcTextSize(_profileData.Description, wrapWidth: 256f);
var childFrame = ImGuiHelpers.ScaledVector2(256 + ImGui.GetStyle().WindowPadding.X + ImGui.GetStyle().WindowBorderSize, 256); var childFrame = ImGuiHelpers.ScaledVector2(256 + ImGui.GetStyle().WindowPadding.X + ImGui.GetStyle().WindowBorderSize, 256);
if (descriptionTextSize.Y > childFrame.Y) if (descriptionTextSize.Y > childFrame.Y)
{ {
@@ -245,17 +249,18 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
}; };
if (ImGui.BeginChildFrame(101, childFrame)) if (ImGui.BeginChildFrame(101, childFrame))
{ {
UiSharedService.TextWrapped(profile.Description); UiSharedService.TextWrapped(_profileData.Description);
} }
ImGui.EndChildFrame(); ImGui.EndChildFrame();
ImGui.TreePop();
}
} }
_uiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 1.5f);
ImGui.EndTabItem();
} }
if (ImGui.BeginTabItem("Profile Settings")) ImGui.Separator();
if (_uiSharedService.MediumTreeNode("Profile Settings", UIColors.Get("LightlessPurple")))
{ {
_uiSharedService.MediumText("Profile Settings", UIColors.Get("LightlessPurple"));
ImGui.Dummy(new Vector2(5)); ImGui.Dummy(new Vector2(5));
if (_uiSharedService.IconTextButton(FontAwesomeIcon.FileUpload, "Upload new profile picture")) if (_uiSharedService.IconTextButton(FontAwesomeIcon.FileUpload, "Upload new profile picture"))
@@ -345,6 +350,8 @@ public class SyncshellAdminUI : WindowMediatorSubscriberBase
_ = _apiController.GroupSetProfile(new GroupProfileDto(new GroupData(GroupFullInfo.Group.GID), Description: null, Tags: null, PictureBase64: null)); _ = _apiController.GroupSetProfile(new GroupProfileDto(new GroupData(GroupFullInfo.Group.GID), Description: null, Tags: null, PictureBase64: null));
} }
UiSharedService.AttachToolTip("Clears your profile description text"); UiSharedService.AttachToolTip("Clears your profile description text");
ImGui.TreePop();
}
} }
profileTab.Dispose(); profileTab.Dispose();
} }