add contextual information to settings ui

This commit is contained in:
Stanley Dimant
2024-10-29 21:38:28 +01:00
parent 18ece74c6d
commit c671003bac

View File

@@ -1325,7 +1325,16 @@ public class SettingsUi : WindowMediatorSubscriberBase
{ {
thisIsYou = true; thisIsYou = true;
} }
if (ImGui.TreeNode($"chara", (thisIsYou ? "[CURRENT] " : "") + $"Character: {item.CharacterName}, World: {worldPreview}, {friendlyNameTranslation}: {friendlyName}")) bool misManaged = false;
if (selectedServer.UseOAuth2 && !string.IsNullOrEmpty(selectedServer.OAuthToken) && string.IsNullOrEmpty(item.UID))
{
misManaged = true;
}
if (!selectedServer.UseOAuth2 && item.SecretKeyIdx == -1)
{
misManaged = true;
}
if (ImGui.TreeNode($"chara", (misManaged ? "[!! MISMANAGED !!] " : "") + (thisIsYou ? "[CURRENT] " : "") + $"Character: {item.CharacterName}, World: {worldPreview}, {friendlyNameTranslation}: {friendlyName}"))
{ {
var charaName = item.CharacterName; var charaName = item.CharacterName;
if (ImGui.InputText("Character Name", ref charaName, 64)) if (ImGui.InputText("Character Name", ref charaName, 64))
@@ -1477,6 +1486,12 @@ public class SettingsUi : WindowMediatorSubscriberBase
if (useOauth) if (useOauth)
{ {
_uiShared.DrawOAuth(selectedServer); _uiShared.DrawOAuth(selectedServer);
if (!string.IsNullOrEmpty(_serverConfigurationManager.GetDiscordUserFromToken(selectedServer))
&& selectedServer.Authentications.TrueForAll(u => string.IsNullOrEmpty(u.UID)))
{
UiSharedService.ColorTextWrapped("You have enabled OAuth2 but no characters configured. Set the correct UIDs for your characters in \"Character Management\".",
ImGuiColors.DalamudRed);
}
} }
if (!isMain && selectedServer != _serverConfigurationManager.CurrentServer) if (!isMain && selectedServer != _serverConfigurationManager.CurrentServer)