Files
HellionChat/HellionChat/Ui/TabIconMapping.cs
T
JonKazama-Hellion c4c85cf4b8 docs: unify documentation and streamline code comments
- Translated project documentation (LEARNING-JOURNEY, CONTRIBUTORS, AI_DISCLOSURE) to English for better accessibility.
- Standardized internal code documentation by converting XML-doc blocks to standard comment format.
- Cleaned up inline comments and removed redundant versioning metadata across the codebase.
- Refactored non-functional text elements to improve readability and maintain a consistent style.
2026-05-11 00:52:15 +02:00

46 lines
1.9 KiB
C#

using Dalamud.Interface;
namespace HellionChat.Ui;
// Default icon mapping for tabs, used in top-tabs (icon prefix) and sidebar (icon-only with tooltip).
// Users can override per tab via Settings -> Tabs -> Tab.Icon.
// Pure string resolver logic lives in TabIconGlyphResolver (no Dalamud dependency) for testability.
internal static class TabIconMapping
{
// Glyph name -> FontAwesomeIcon lookup for production resolve.
// Every key must also exist in TabIconGlyphResolver.PickerOptions.
// A missing key silently falls back to FontAwesomeIcon.Hashtag (degraded, no crash).
private static readonly Dictionary<string, FontAwesomeIcon> GlyphLookup = new(
StringComparer.OrdinalIgnoreCase
)
{
["comment"] = FontAwesomeIcon.Comment,
["comments"] = FontAwesomeIcon.Comments,
["cog"] = FontAwesomeIcon.Cog,
["users"] = FontAwesomeIcon.Users,
["user-friends"] = FontAwesomeIcon.UserFriends,
["link"] = FontAwesomeIcon.Link,
["envelope"] = FontAwesomeIcon.Envelope,
["clock"] = FontAwesomeIcon.Clock,
["hashtag"] = FontAwesomeIcon.Hashtag,
["star"] = FontAwesomeIcon.Star,
["heart"] = FontAwesomeIcon.Heart,
["bell"] = FontAwesomeIcon.Bell,
["bookmark"] = FontAwesomeIcon.Bookmark,
["flag"] = FontAwesomeIcon.Flag,
["fire"] = FontAwesomeIcon.Fire,
};
// Resolves the icon for a tab. Auto-tell tabs get a per-partner hashed icon
// from the tell pool so parallel tells differ by glyph shape, not just colour.
public static FontAwesomeIcon Resolve(Tab tab)
{
string? autoTellGlyph = null;
if (tab.IsTempTab && tab.TellTarget != null && tab.TellTarget.IsSet())
autoTellGlyph = TabTintCache.GetIcon(tab);
var glyph = TabIconGlyphResolver.ResolveGlyphName(tab, autoTellGlyph);
return GlyphLookup.TryGetValue(glyph, out var icon) ? icon : FontAwesomeIcon.Hashtag;
}
}