(skillId: string, trigger?: HTMLElement)
| 100 | } |
| 101 | |
| 102 | function openSkillDetailsModal(skillId: string, trigger?: HTMLElement): void { |
| 103 | const item = skillById.get(skillId); |
| 104 | if (!item) { |
| 105 | return; |
| 106 | } |
| 107 | |
| 108 | const metaParts: string[] = []; |
| 109 | if (item.hasAssets) { |
| 110 | metaParts.push( |
| 111 | `<span class="resource-tag tag-assets">${item.assetCount} asset${ |
| 112 | item.assetCount === 1 ? '' : 's' |
| 113 | }</span>` |
| 114 | ); |
| 115 | } |
| 116 | |
| 117 | metaParts.push( |
| 118 | `<span class="resource-tag">${item.files.length} file${ |
| 119 | item.files.length === 1 ? '' : 's' |
| 120 | }</span>` |
| 121 | ); |
| 122 | |
| 123 | if (item.lastUpdated) { |
| 124 | metaParts.push( |
| 125 | `<span class="last-updated">Updated ${escapeHtml( |
| 126 | formatRelativeTime(item.lastUpdated) |
| 127 | )}</span>` |
| 128 | ); |
| 129 | } |
| 130 | |
| 131 | const fileTagParts = item.files |
| 132 | .slice(0, 24) |
| 133 | .map((file) => `<span class="resource-tag">${escapeHtml(file.name)}</span>`); |
| 134 | if (item.files.length > 24) { |
| 135 | fileTagParts.push(`<span class="resource-tag">+${item.files.length - 24} more</span>`); |
| 136 | } |
| 137 | |
| 138 | const actionsHtml = ` |
| 139 | <button id="skill-details-install" class="btn btn-secondary" type="button" data-skill-id="${escapeHtml( |
| 140 | item.id |
| 141 | )}">Copy Install</button> |
| 142 | <button id="skill-details-download" class="btn btn-primary" type="button" data-skill-id="${escapeHtml( |
| 143 | item.id |
| 144 | )}">Download</button> |
| 145 | <button class="btn btn-secondary" type="button" data-open-file-path="${escapeHtml( |
| 146 | item.skillFile |
| 147 | )}" data-open-file-type="skill">Source</button> |
| 148 | `; |
| 149 | |
| 150 | openCardDetailsModal({ |
| 151 | title: item.title, |
| 152 | description: item.description || 'No description', |
| 153 | previewIcon: '⚡', |
| 154 | previewText: 'Skill files and install options', |
| 155 | metaHtml: metaParts.join(''), |
| 156 | tagsHtml: fileTagParts.join(''), |
| 157 | actionsHtml, |
| 158 | trigger, |
| 159 | }); |
no test coverage detected