MCPcopy
hub / github.com/github/awesome-copilot / renderAgentsHtml

Function renderAgentsHtml

website/src/scripts/pages/agents-render.ts:39–92  ·  view source on GitHub ↗
(items: RenderableAgent[])

Source from the content-addressed store, hash-verified

37}
38
39export function renderAgentsHtml(items: RenderableAgent[]): string {
40 if (items.length === 0) {
41 return renderEmptyStateHtml("No agents found", "No agents are available right now.");
42 }
43
44 return items
45 .map((item) => {
46 const metaHtml = `
47 ${
48 item.model
49 ? `<span class="resource-tag tag-model">${escapeHtml(
50 Array.isArray(item.model) ? item.model.join(", ") : item.model
51 )}</span>`
52 : ""
53 }
54 ${
55 item.tools
56 ?.slice(0, 3)
57 .map((tool) => `<span class="resource-tag">${escapeHtml(tool)}</span>`)
58 .join("") || ""
59 }
60 ${
61 item.tools && item.tools.length > 3
62 ? `<span class="resource-tag">+${item.tools.length - 3} more</span>`
63 : ""
64 }
65 ${
66 item.hasHandoffs
67 ? `<span class="resource-tag tag-handoffs">handoffs</span>`
68 : ""
69 }
70 ${getLastUpdatedHtml(item.lastUpdated)}
71 `;
72
73 const actionsHtml = `
74 ${getInstallDropdownHtml(resourceType, item.path, true)}
75 ${getActionButtonsHtml(item.path, true)}
76 <a href="${getGitHubUrl(item.path)}" class="btn btn-secondary btn-small" target="_blank" onclick="event.stopPropagation()" title="View on GitHub">
77 GitHub
78 </a>
79 `;
80
81 return renderSharedCardHtml({
82 title: item.title,
83 description: item.description || "No description",
84 articleAttributes: {
85 "data-path": item.path,
86 },
87 metaHtml,
88 actionsHtml,
89 });
90 })
91 .join("");
92}

Callers 1

renderItemsFunction · 0.90

Calls 7

renderEmptyStateHtmlFunction · 0.90
escapeHtmlFunction · 0.90
getLastUpdatedHtmlFunction · 0.90
getInstallDropdownHtmlFunction · 0.90
getActionButtonsHtmlFunction · 0.90
getGitHubUrlFunction · 0.90
renderSharedCardHtmlFunction · 0.90

Tested by

no test coverage detected