| 1 | namespace AgentForge.Plugin.View.Components.Iop; |
| 2 | |
| 3 | internal static class ForgeViewIopHandoffForm |
| 4 | { |
| 5 | internal static string Render(string repoName, int number, IReadOnlyList<string> targetRepos) |
| 6 | { |
| 7 | if (targetRepos.Count == 0) |
| 8 | return ""; |
| 9 | |
| 10 | var action = $"/view/repos/{ForgeRepoNames.ToUrlPath(repoName)}/merge-requests/{number}/handoff"; |
| 11 | var options = targetRepos |
| 12 | .Select(target => ForgeHtml.Option(target, target, selected: false)) |
| 13 | .ToArray(); |
| 14 | |
| 15 | return ForgeHtml.Div("iop-handoff", |
| 16 | ForgeHtml.P("iop-meta", |
| 17 | ForgeHtml.Strong("Hand off"), |
| 18 | ForgeHtml.Text(" — relay this MR to another repo (opens a linked MR on the target).")), |
| 19 | ForgeHtml.Form("post", action, "iop-handoff-form", |
| 20 | ForgeHtml.LabelWithClass("handoff-target", "sr-only", ForgeHtml.Text("Target repository")), |
| 21 | ForgeHtml.Select("handoff-target", "targetRepo", "branch-select", required: true, options), |
| 22 | ForgeHtml.Button("submit", "Hand off", "btn-handoff"))); |
| 23 | } |
| 24 | } |
| 25 | |