(children, groupKey = '')
| 19244 | const favBtn = document.createElement('button'); |
| 19245 | favBtn.type = 'button'; |
| 19246 | favBtn.className = 'model-favorite-btn'; |
| 19247 | favBtn.setAttribute('aria-pressed', favorite ? 'true' : 'false'); |
| 19248 | favBtn.title = groupMode ? 'Favorite all models in group' : 'Favorite'; |
| 19249 | favBtn.textContent = favorite ? '♥' : '♡'; |
| 19250 | |
| 19251 | favBtn.addEventListener('click', async (e) => { |
| 19252 | e.preventDefault(); |
| 19253 | e.stopPropagation(); |
| 19254 | const newFavorite = !favorite; |
| 19255 | if (groupMode) { |
| 19256 | const ok = await bulkSaveModelsEngagement(filePaths, 'favorite', newFavorite); |
| 19257 | if (ok) { |
| 19258 | favorite = newFavorite; |
| 19259 | children.forEach((c) => { if (c) c.favorite = newFavorite; }); |
| 19260 | updateEngagementBarDisplay(bar, rating, favorite); |
| 19261 | } |
| 19262 | } else { |
| 19263 | const ok = await autoSaveModel('favorite', newFavorite, context.filePath); |
| 19264 | if (ok) { |
| 19265 | favorite = newFavorite; |
| 19266 | updateEngagementBarDisplay(bar, rating, favorite); |
| 19267 | } |
| 19268 | } |
| 19269 | }); |
| 19270 | |
| 19271 | bar.appendChild(ratingWrap); |
| 19272 | bar.appendChild(favBtn); |
| 19273 | updateEngagementBarDisplay(bar, rating, favorite); |
| 19274 | |
| 19275 | return bar; |
no outgoing calls
no test coverage detected