From 304e1aab20a36725a198f9e0ee62d6694e17083e Mon Sep 17 00:00:00 2001 From: Jon Kazama Date: Tue, 26 May 2026 18:00:53 +0200 Subject: [PATCH] feat(settings): add LivePreviewPanel skeleton --- .../Components/Settings/LivePreviewPanel.cs | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 HellionChat/Ui/Components/Settings/LivePreviewPanel.cs diff --git a/HellionChat/Ui/Components/Settings/LivePreviewPanel.cs b/HellionChat/Ui/Components/Settings/LivePreviewPanel.cs new file mode 100644 index 0000000..383b095 --- /dev/null +++ b/HellionChat/Ui/Components/Settings/LivePreviewPanel.cs @@ -0,0 +1,88 @@ +using System.Numerics; +using System.Threading; +using Dalamud.Bindings.ImGui; +using Dalamud.Interface.Utility.Raii; +using HellionChat.Themes; +using HellionChat.Ui.StyleEngine; + +namespace HellionChat.Ui.Components.Settings; + +internal sealed class LivePreviewPanel : IDisposable +{ + // Static counter for S5 reload-stress verification: after 10 reloads the + // counter must read 0 (plugin disabled) or 1 (plugin enabled). Anything + // higher signals a Dispose skip and a subscriber leak against ThemeRegistry. + internal static int InstanceCount; + + private readonly ThemeRegistry _themes; + private readonly TokenResolver _resolver; + + public LivePreviewPanel(ThemeRegistry themes, TokenResolver resolver) + { + _themes = themes; + _resolver = resolver; + _themes.OnEditingBufferChanged += OnBufferChanged; + Interlocked.Increment(ref InstanceCount); + } + + public void Dispose() + { + _themes.OnEditingBufferChanged -= OnBufferChanged; + Interlocked.Decrement(ref InstanceCount); + } + + private void OnBufferChanged() + { + // Visual repaint already runs per frame via Draw(); hook reserved for + // future telemetry or invalidation. Keep empty in v1.7.0. + } + + public void Draw() + { + using var child = ImRaii.Child("##settings-live-preview", new Vector2(280, 0), true); + if (!child.Success) + { + return; + } + + var theme = _themes.EditingThemeBuffer ?? _themes.Active; + + DrawBrandBar(theme); + DrawHonorificHeader(theme); + DrawSidebar(theme); + DrawMessageList(theme); + DrawInputBar(theme); + DrawStatusBar(theme); + } + + private void DrawBrandBar(Theme theme) + { + // Mini gradient: PrimaryDark → Primary → PrimaryLight → PrimaryGlow. + // Implementation lands in next sub-step. + } + + private void DrawHonorificHeader(Theme theme) + { + // Crown + Brackets-Title in Identity. Implementation in next sub-step. + } + + private void DrawSidebar(Theme theme) + { + // 3 channel rows. Implementation in next sub-step. + } + + private void DrawMessageList(Theme theme) + { + // 4 mock messages. Implementation in next sub-step. + } + + private void DrawInputBar(Theme theme) + { + // Pill + text + cog. Implementation in next sub-step. + } + + private void DrawStatusBar(Theme theme) + { + // Status icons. Implementation in next sub-step. + } +}