feat(settings): add TabSidebar with seven entries

This commit is contained in:
2026-05-26 15:59:01 +02:00
parent ffef5634ed
commit bb37e19176
2 changed files with 55 additions and 0 deletions
+3
View File
@@ -143,6 +143,9 @@ internal static class PluginHostFactory
sp.GetRequiredService<ILogger<Ui.Components.InputBar>>(), sp.GetRequiredService<ILogger<Ui.Components.InputBar>>(),
() => sp.GetRequiredService<Plugin>().SettingsWindow.Toggle() () => sp.GetRequiredService<Plugin>().SettingsWindow.Toggle()
)); ));
services.AddSingleton(sp => new Ui.Components.Settings.TabSidebar(
sp.GetRequiredService<FontManager>()
));
services.AddSingleton(sp => new Ui.Components.StatusBar( services.AddSingleton(sp => new Ui.Components.StatusBar(
sp.GetRequiredService<ThemeRegistry>(), sp.GetRequiredService<ThemeRegistry>(),
sp.GetRequiredService<FontManager>() sp.GetRequiredService<FontManager>()
@@ -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<string>? 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);
}
}
}