* Render modal content for a local plugin (item list)
( plugin: Plugin, modalContent: HTMLElement )
| 1283 | * Render modal content for a local plugin (item list) |
| 1284 | */ |
| 1285 | function renderLocalPluginModal( |
| 1286 | plugin: Plugin, |
| 1287 | modalContent: HTMLElement |
| 1288 | ): void { |
| 1289 | modalContent.innerHTML = ` |
| 1290 | <div class="collection-view"> |
| 1291 | <div class="collection-description">${escapeHtml( |
| 1292 | plugin.description || "" |
| 1293 | )}</div> |
| 1294 | ${ |
| 1295 | plugin.tags && plugin.tags.length > 0 |
| 1296 | ? ` |
| 1297 | <div class="collection-tags"> |
| 1298 | ${plugin.tags |
| 1299 | .map((t) => `<span class="resource-tag">${escapeHtml(t)}</span>`) |
| 1300 | .join("")} |
| 1301 | </div> |
| 1302 | ` |
| 1303 | : "" |
| 1304 | } |
| 1305 | <div class="collection-items-header"> |
| 1306 | <strong>${plugin.items.length} items in this plugin</strong> |
| 1307 | </div> |
| 1308 | <div class="collection-items-list"> |
| 1309 | ${plugin.items |
| 1310 | .map( |
| 1311 | (item) => ` |
| 1312 | <div class="collection-item" data-path="${escapeHtml( |
| 1313 | item.path |
| 1314 | )}" data-type="${escapeHtml(item.kind)}"> |
| 1315 | <span class="collection-item-icon">${getResourceIconSvg( |
| 1316 | item.kind |
| 1317 | )}</span> |
| 1318 | <div class="collection-item-info"> |
| 1319 | <div class="collection-item-name">${escapeHtml( |
| 1320 | item.path.split("/").pop() || item.path |
| 1321 | )}</div> |
| 1322 | ${ |
| 1323 | item.usage |
| 1324 | ? `<div class="collection-item-usage">${escapeHtml( |
| 1325 | item.usage |
| 1326 | )}</div>` |
| 1327 | : "" |
| 1328 | } |
| 1329 | </div> |
| 1330 | <span class="collection-item-type">${escapeHtml(item.kind)}</span> |
| 1331 | </div> |
| 1332 | ` |
| 1333 | ) |
| 1334 | .join("")} |
| 1335 | </div> |
| 1336 | </div> |
| 1337 | `; |
| 1338 | |
| 1339 | // Add click handlers to plugin items |
| 1340 | modalContent.querySelectorAll(".collection-item").forEach((el) => { |
| 1341 | el.addEventListener("click", () => { |
| 1342 | let path = (el as HTMLElement).dataset.path; |
no test coverage detected