Forge
csharp3407750f
1namespace AgentForge.Plugin.View.Components.Iop;
2
3internal static class ForgeViewIopSubTabs
4{
5 internal static string Render(
6 ForgeIopTabLinks tabLinks,
7 string activeTab,
8 int commentCount,
9 int changeCount,
10 bool hasCi)
11 {
12 var normalized = ForgeIopTabs.Normalize(activeTab);
13 return ForgeHtml.Nav("iop-subtabs", "Merge request panel",
14 RenderTab(tabLinks.ConversationHref, "Conversation", "conversation", normalized, commentCount),
15 RenderTab(tabLinks.ChangesHref, "Changes", "changes", normalized, changeCount),
16 RenderTab(tabLinks.ChecksHref, "Checks", "checks", normalized, hasCi ? 1 : 0));
17 }
18
19 private static string RenderTab(string href, string label, string tabId, string activeTab, int count)
20 {
21 var active = string.Equals(tabId, activeTab, StringComparison.Ordinal);
22 var cssClass = active ? "iop-subtab active" : "iop-subtab";
23 var inner = count > 0
24 ? ForgeHtml.Fragment(
25 ForgeHtml.Text(label),
26 ForgeHtml.Span("iop-subtab-count", ForgeHtml.Text(count.ToString())))
27 : ForgeHtml.Text(label);
28
29 return ForgeHtml.ARaw(href, cssClass, null, null, inner);
30 }
31}
32
33internal static class ForgeIopTabs
34{
35 internal static string Normalize(string? tab) => tab?.Trim().ToLowerInvariant() switch
36 {
37 "changes" => "changes",
38 "checks" => "checks",
39 _ => "conversation",
40 };
41}
42
View only · write via MCP/CIDE