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

Function renderSkillsHtml

website/src/scripts/pages/skills-render.ts:43–100  ·  view source on GitHub ↗
(items: RenderableSkill[])

Source from the content-addressed store, hash-verified

41}
42
43export function renderSkillsHtml(items: RenderableSkill[]): string {
44 if (items.length === 0) {
45 return renderEmptyStateHtml("No skills found", "No skills are available right now.");
46 }
47
48 return items
49 .map((item) => {
50 const metaHtml = `
51 ${
52 item.hasAssets
53 ? `<span class="resource-tag tag-assets">${item.assetCount} asset${
54 item.assetCount === 1 ? "" : "s"
55 }</span>`
56 : ""
57 }
58 <span class="resource-tag">${item.files.length} file${
59 item.files.length === 1 ? "" : "s"
60 }</span>
61 ${getLastUpdatedHtml(item.lastUpdated)}
62 `;
63
64 const actionsHtml = `
65 <button class="btn btn-secondary copy-install-btn" data-skill-id="${escapeHtml(
66 item.id
67 )}" title="Copy install command">
68 <svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor" aria-hidden="true">
69 <path d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/>
70 <path d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/>
71 </svg>
72 Copy Install
73 </button>
74 <button class="btn btn-primary download-skill-btn" data-skill-id="${escapeHtml(
75 item.id
76 )}" title="Download as ZIP">
77 <svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor">
78 <path d="M2.75 14A1.75 1.75 0 0 1 1 12.25v-2.5a.75.75 0 0 1 1.5 0v2.5c0 .138.112.25.25.25h10.5a.25.25 0 0 0 .25-.25v-2.5a.75.75 0 0 1 1.5 0v2.5A1.75 1.75 0 0 1 13.25 14Z"/>
79 <path d="M7.25 7.689V2a.75.75 0 0 1 1.5 0v5.689l1.97-1.969a.749.749 0 1 1 1.06 1.06l-3.25 3.25a.749.749 0 0 1-1.06 0L4.22 6.78a.749.749 0 1 1 1.06-1.06l1.97 1.969Z"/>
80 </svg>
81 Download
82 </button>
83 <a href="${getGitHubUrl(
84 item.path
85 )}" class="btn btn-secondary" target="_blank" onclick="event.stopPropagation()" title="View on GitHub">GitHub</a>
86 `;
87
88 return renderSharedCardHtml({
89 title: item.title,
90 description: item.description || "No description",
91 articleAttributes: {
92 "data-path": item.skillFile,
93 "data-skill-id": item.id,
94 },
95 metaHtml,
96 actionsHtml,
97 });
98 })
99 .join("");
100}

Callers 1

renderItemsFunction · 0.90

Calls 5

renderEmptyStateHtmlFunction · 0.90
getLastUpdatedHtmlFunction · 0.90
escapeHtmlFunction · 0.90
getGitHubUrlFunction · 0.90
renderSharedCardHtmlFunction · 0.90

Tested by

no test coverage detected