diff --git a/HellionChat/PluginHostFactory.cs b/HellionChat/PluginHostFactory.cs index 5734e2b..e1abcda 100644 --- a/HellionChat/PluginHostFactory.cs +++ b/HellionChat/PluginHostFactory.cs @@ -143,6 +143,9 @@ internal static class PluginHostFactory sp.GetRequiredService>(), () => sp.GetRequiredService().SettingsWindow.Toggle() )); + services.AddSingleton(sp => new Ui.Components.Settings.TabSidebar( + sp.GetRequiredService() + )); services.AddSingleton(sp => new Ui.Components.StatusBar( sp.GetRequiredService(), sp.GetRequiredService() diff --git a/HellionChat/Ui/Components/Settings/TabSidebar.cs b/HellionChat/Ui/Components/Settings/TabSidebar.cs new file mode 100644 index 0000000..e040c97 --- /dev/null +++ b/HellionChat/Ui/Components/Settings/TabSidebar.cs @@ -0,0 +1,52 @@ +using System.Numerics; +using Dalamud.Bindings.ImGui; +using Dalamud.Interface; +using Dalamud.Interface.Utility.Raii; + +namespace HellionChat.Ui.Components.Settings; + +internal sealed class TabSidebar +{ + private readonly FontManager _fonts; + + public event Action? OnTabSelected; + public string ActiveTab { get; private set; } = "general"; + + public TabSidebar(FontManager fonts) + { + _fonts = fonts; + } + + public void Draw() + { + using var child = ImRaii.Child("##settings-tab-sidebar", new Vector2(170, 0), true); + if (!child.Success) + { + return; + } + + DrawEntry("general", FontAwesomeIcon.SlidersH, "General"); + DrawEntry("appearance", FontAwesomeIcon.Palette, "Appearance"); + DrawEntry("chat", FontAwesomeIcon.Comments, "Chat"); + DrawEntry("window", FontAwesomeIcon.WindowMaximize, "Window"); + DrawEntry("channels", FontAwesomeIcon.Hashtag, "Channels"); + DrawEntry("data-privacy", FontAwesomeIcon.Shield, "Data & Privacy"); + DrawEntry("about", FontAwesomeIcon.InfoCircle, "About"); + } + + private void DrawEntry(string id, FontAwesomeIcon icon, string label) + { + using (_fonts.FontAwesome.Push()) + { + ImGui.TextUnformatted(icon.ToIconString()); + } + ImGui.SameLine(); + + var selected = ActiveTab == id; + if (ImGui.Selectable($" {label}##tab-{id}", selected)) + { + ActiveTab = id; + OnTabSelected?.Invoke(id); + } + } +}