From 089731ae320f8fd69c7571c2371cfab871255ad6 Mon Sep 17 00:00:00 2001 From: xPumaa <35280763+xPumaa@users.noreply.github.com> Date: Fri, 5 Aug 2022 12:01:58 +0200 Subject: [PATCH] Fixed: Save button is not displayed under certain circumstances --- MareSynchronos/UI/UIShared.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/MareSynchronos/UI/UIShared.cs b/MareSynchronos/UI/UIShared.cs index 3074b52..7d9b135 100644 --- a/MareSynchronos/UI/UIShared.cs +++ b/MareSynchronos/UI/UIShared.cs @@ -347,8 +347,15 @@ namespace MareSynchronos.UI ColorTextWrapped("IF YOU HAVE NEVER MADE AN ACCOUNT BEFORE DO NOT ENTER ANYTHING HERE", ImGuiColors.DalamudYellow); } - ImGui.SetNextItemWidth(400); - ImGui.InputText("Enter Secret Key", ref _secretKey, 255); + var text = "Enter Secret Key"; + var buttonText = "Save"; + var buttonWidth = _secretKey.Length != 64 ? 0 : ImGuiHelpers.GetButtonSize(buttonText).X + ImGui.GetStyle().ItemSpacing.X; + var textSize = ImGui.CalcTextSize(text); + ImGui.AlignTextToFramePadding(); + ImGui.Text(text); + ImGui.SameLine(); + ImGui.SetNextItemWidth(GetWindowContentRegionWidth() - ImGui.GetWindowContentRegionMin().X - buttonWidth - textSize.X); + ImGui.InputText("", ref _secretKey, 64); if (_secretKey.Length > 0 && _secretKey.Length != 64) { ColorTextWrapped("Your secret key must be exactly 64 characters long. Don't enter your Lodestone auth here.", ImGuiColors.DalamudRed); @@ -356,7 +363,7 @@ namespace MareSynchronos.UI else if (_secretKey.Length == 64) { ImGui.SameLine(); - if (ImGui.Button("Save")) + if (ImGui.Button(buttonText)) { _pluginConfiguration.ClientSecret[_pluginConfiguration.ApiUri] = _secretKey; _pluginConfiguration.Save();