MCPcopy Index your code
hub / github.com/github/awesome-copilot / openPluginDetailsModal

Function openPluginDetailsModal

website/src/scripts/pages/plugins.ts:117–184  ·  view source on GitHub ↗
(path: string, trigger?: HTMLElement)

Source from the content-addressed store, hash-verified

115}
116
117function openPluginDetailsModal(path: string, trigger?: HTMLElement): void {
118 const item = pluginByPath.get(path);
119 if (!item) {
120 return;
121 }
122
123 const metaParts: string[] = [];
124 metaParts.push(
125 `<span class="resource-tag">${
126 item.external ? 'External plugin' : `${item.itemCount} items`
127 }</span>`
128 );
129
130 if (item.author?.name) {
131 metaParts.push(`<span class="resource-tag">by ${escapeHtml(item.author.name)}</span>`);
132 }
133
134 if (item.lastUpdated) {
135 metaParts.push(
136 `<span class="last-updated">Updated ${escapeHtml(
137 formatRelativeTime(item.lastUpdated)
138 )}</span>`
139 );
140 }
141
142 const tagHtml = (item.tags || [])
143 .map((tagText) => `<span class="resource-tag">${escapeHtml(tagText)}</span>`)
144 .join('');
145
146 const includedItems = item.items || [];
147 const includedItemHtml = includedItems
148 .slice(0, 24)
149 .map(
150 (pluginItem) =>
151 `<span class="resource-tag tag-plugin-item">${escapeHtml(getPluginItemLabel(pluginItem))}</span>`
152 )
153 .join('');
154 const includedMoreHtml =
155 includedItems.length > 24
156 ? `<span class="resource-tag">+${includedItems.length - 24} more</span>`
157 : '';
158
159 const actions = [
160 item.external
161 ? ''
162 : `<button id="plugin-details-install" class="btn btn-primary" type="button" data-plugin-name="${escapeHtml(
163 item.name
164 )}">Copy Install</button>`,
165 item.external
166 ? `<a class="btn btn-secondary" href="${escapeHtml(
167 getPluginRepositoryUrl(item)
168 )}" target="_blank" rel="noopener noreferrer">Repository</a>`
169 : `<button class="btn btn-secondary" type="button" data-open-file-path="${escapeHtml(
170 item.path
171 )}" data-open-file-type="plugin">Source</button>`,
172 ].filter(Boolean);
173
174 openCardDetailsModal({

Callers 1

Calls 5

escapeHtmlFunction · 0.90
formatRelativeTimeFunction · 0.90
openCardDetailsModalFunction · 0.90
getPluginItemLabelFunction · 0.85
getPluginRepositoryUrlFunction · 0.85

Tested by

no test coverage detected