(filePath: string, small = false)
| 624 | * Generate HTML for action buttons (download, share) in list view |
| 625 | */ |
| 626 | export function getActionButtonsHtml(filePath: string, small = false): string { |
| 627 | const btnClass = small ? "btn-small" : ""; |
| 628 | const iconSize = small ? 14 : 16; |
| 629 | |
| 630 | return ` |
| 631 | <button class="btn btn-secondary ${btnClass} action-download" data-path="${escapeHtml( |
| 632 | filePath |
| 633 | )}" title="Download file"> |
| 634 | <svg viewBox="0 0 16 16" width="${iconSize}" height="${iconSize}" fill="currentColor"> |
| 635 | <path d="M7.47 10.78a.75.75 0 0 0 1.06 0l3.75-3.75a.75.75 0 0 0-1.06-1.06L8.75 8.44V1.75a.75.75 0 0 0-1.5 0v6.69L4.78 5.97a.75.75 0 0 0-1.06 1.06l3.75 3.75ZM3.75 13a.75.75 0 0 0 0 1.5h8.5a.75.75 0 0 0 0-1.5h-8.5Z"/> |
| 636 | </svg> |
| 637 | </button> |
| 638 | <button class="btn btn-secondary ${btnClass} action-share" data-path="${escapeHtml( |
| 639 | filePath |
| 640 | )}" title="Copy link"> |
| 641 | <svg viewBox="0 0 16 16" width="${iconSize}" height="${iconSize}" fill="currentColor"> |
| 642 | <path d="M7.775 3.275a.75.75 0 0 0 1.06 1.06l1.25-1.25a2 2 0 1 1 2.83 2.83l-2.5 2.5a2 2 0 0 1-2.83 0 .75.75 0 0 0-1.06 1.06 3.5 3.5 0 0 0 4.95 0l2.5-2.5a3.5 3.5 0 0 0-4.95-4.95l-1.25 1.25zm-.025 5.45a.75.75 0 0 0-1.06-1.06l-1.25 1.25a2 2 0 1 1-2.83-2.83l2.5-2.5a2 2 0 0 1 2.83 0 .75.75 0 0 0 1.06-1.06 3.5 3.5 0 0 0-4.95 0l-2.5 2.5a3.5 3.5 0 0 0 4.95 4.95l1.25-1.25z"/> |
| 643 | </svg> |
| 644 | </button> |
| 645 | `; |
| 646 | } |
| 647 | |
| 648 | /** |
| 649 | * Setup global action handlers for download and share buttons |
no test coverage detected