From b1dfe35d133a7d0d908b434307cc9492f9b0d85a Mon Sep 17 00:00:00 2001 From: nxships <2096086+nxships@users.noreply.github.com> Date: Mon, 25 May 2026 13:41:07 +0200 Subject: [PATCH] feat(ui): add NexusStatusNotice widget with Text/Tooltip/Both modes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A reusable "something is going on in the background" cue that the PlayerNexusTracker detail panel had been re-implementing twice — once inline as a grey wrapped banner inside tab bodies, once as an inline yellow hourglass with hover tooltip in the panel header. Same icon, same loc key, same player-loaded guard; only the presentation differed. The widget collapses both presentations into one call site by carrying a mode enum: - Text icon + wrapped text laid out as a block element. Grey by default, matching the legacy LodestonePlaceholder wrap. - Tooltip icon only; hover shows the tooltip. Yellow by default and SameLine-friendly, matching the legacy NexusHint hourglass. - Both icon + wrapped text AND a hover tooltip on the icon, with optional separate tooltipText so a short banner can carry a longer hover explainer. Caller decides text + (optional) separate tooltipText, icon, color override, and sameLine. Defaults track the existing palette (yellow for Tooltip, grey otherwise) so the migrating call sites keep their visual contract. NexusHint is intentionally left in place — it is still the right tool for one-off field-change / gender / FC-candidate hints. This widget is the higher-level "named status" cue. --- NexusKit.Ui/Widgets/NexusStatusNotice.cs | 64 ++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 NexusKit.Ui/Widgets/NexusStatusNotice.cs diff --git a/NexusKit.Ui/Widgets/NexusStatusNotice.cs b/NexusKit.Ui/Widgets/NexusStatusNotice.cs new file mode 100644 index 0000000..fd2d8a4 --- /dev/null +++ b/NexusKit.Ui/Widgets/NexusStatusNotice.cs @@ -0,0 +1,64 @@ +using System.Numerics; +using Dalamud.Bindings.ImGui; +using Dalamud.Interface; +using Dalamud.Interface.Colors; + +namespace NexusKit.Ui.Widgets; + +public enum NexusStatusNoticeMode +{ + /// Icon + wrapped text laid out as a block element. No hover behavior. + Text, + /// Icon only; hover shows the tooltip. SameLine-friendly (header badge). + Tooltip, + /// Icon + wrapped text AND a hover tooltip on the icon. Tooltip text + /// can differ from the body text when the caller passes a separate + /// tooltipText. + Both, +} + +/// +/// Shared "something is going on in the background" notice. Three modes let the +/// same widget carry an inline icon-with-tooltip in a header AND a full wrapped +/// status line at the top of a tab body without duplicating either code path. +/// Color defaults track the existing palette: yellow for icon-only badges +/// (matches the pattern), grey for full-text notices +/// (matches the legacy LodestonePlaceholder wrap). Either default can be +/// overridden via the color argument. +/// +public static class NexusStatusNotice +{ + public static void Draw( + NexusStatusNoticeMode mode, + FontAwesomeIcon icon, + string text, + string? tooltipText = null, + Vector4? color = null, + bool sameLine = false) + { + if (sameLine) ImGui.SameLine(); + + var resolvedColor = color ?? (mode == NexusStatusNoticeMode.Tooltip + ? ImGuiColors.DalamudYellow + : ImGuiColors.DalamudGrey); + + ImGui.PushFont(UiBuilder.IconFont); + ImGui.TextColored(resolvedColor, icon.ToIconString()); + ImGui.PopFont(); + + if (mode is NexusStatusNoticeMode.Tooltip or NexusStatusNoticeMode.Both) + { + var tip = tooltipText ?? text; + if (!string.IsNullOrEmpty(tip) && ImGui.IsItemHovered()) + ImGui.SetTooltip(tip); + } + + if (mode is NexusStatusNoticeMode.Text or NexusStatusNoticeMode.Both) + { + ImGui.SameLine(); + ImGui.PushTextWrapPos(); + ImGui.TextColored(resolvedColor, text); + ImGui.PopTextWrapPos(); + } + } +}