(recipe)
| 580 | recipeRailEl.innerHTML = ''; |
| 581 | |
| 582 | const addRecipeButton = (recipe) => { |
| 583 | const wrap = document.createElement('div'); |
| 584 | wrap.style.display = 'inline-flex'; |
| 585 | wrap.style.alignItems = 'center'; |
| 586 | wrap.style.gap = '4px'; |
| 587 | wrap.style.maxWidth = '100%'; |
| 588 | |
| 589 | const runBtn = document.createElement('button'); |
| 590 | runBtn.type = 'button'; |
| 591 | runBtn.className = 'btn btn-sm btn-light'; |
| 592 | runBtn.style.borderRadius = '999px'; |
| 593 | runBtn.style.padding = '4px 10px'; |
| 594 | runBtn.style.fontSize = '11px'; |
| 595 | runBtn.style.lineHeight = '1.2'; |
| 596 | runBtn.style.maxWidth = '260px'; |
| 597 | runBtn.style.overflow = 'hidden'; |
| 598 | runBtn.style.textOverflow = 'ellipsis'; |
| 599 | runBtn.style.whiteSpace = 'nowrap'; |
| 600 | runBtn.textContent = recipe.builtin ? `${recipe.name}` : `${recipe.pinned ? '★ ' : ''}${recipe.name}`; |
| 601 | runBtn.title = recipe.prompt || recipe.name; |
| 602 | runBtn.addEventListener('click', () => runRecipe(recipe)); |
| 603 | wrap.appendChild(runBtn); |
| 604 | |
| 605 | if (!recipe.builtin) { |
| 606 | const pinBtn = document.createElement('button'); |
| 607 | pinBtn.type = 'button'; |
| 608 | pinBtn.className = 'btn btn-sm btn-light'; |
| 609 | pinBtn.style.borderRadius = '999px'; |
| 610 | pinBtn.style.padding = '4px 8px'; |
| 611 | pinBtn.style.fontSize = '11px'; |
| 612 | pinBtn.style.lineHeight = '1.2'; |
| 613 | pinBtn.textContent = recipe.pinned ? 'Unpin' : 'Pin'; |
| 614 | pinBtn.title = recipe.pinned ? 'Unpin recipe' : 'Pin recipe'; |
| 615 | pinBtn.addEventListener('click', (event) => { |
| 616 | event.stopPropagation(); |
| 617 | toggleRecipePin(recipe); |
| 618 | }); |
| 619 | wrap.appendChild(pinBtn); |
| 620 | |
| 621 | const deleteBtn = document.createElement('button'); |
| 622 | deleteBtn.type = 'button'; |
| 623 | deleteBtn.className = 'btn btn-sm btn-light'; |
| 624 | deleteBtn.style.borderRadius = '999px'; |
| 625 | deleteBtn.style.padding = '4px 8px'; |
| 626 | deleteBtn.style.fontSize = '11px'; |
| 627 | deleteBtn.style.lineHeight = '1.2'; |
| 628 | deleteBtn.textContent = 'Delete'; |
| 629 | deleteBtn.title = 'Delete recipe'; |
| 630 | deleteBtn.addEventListener('click', (event) => { |
| 631 | event.stopPropagation(); |
| 632 | deleteRecipe(recipe); |
| 633 | }); |
| 634 | wrap.appendChild(deleteBtn); |
| 635 | } |
| 636 | |
| 637 | recipeRailEl.appendChild(wrap); |
| 638 | }; |
| 639 |
nothing calls this directly
no test coverage detected