feat: add download and share buttons to list view and modal

- Add Download button to download file as .md file
- Add Share button to copy GitHub link to clipboard
- Both buttons appear in modal header and list view actions
- Use icon-only buttons in list view for cleaner UI
This commit is contained in:
Aaron Powell
2026-01-29 09:44:31 +11:00
parent 009c6c72f8
commit d450d7d3d5
7 changed files with 114 additions and 5 deletions

View File

@@ -3,7 +3,7 @@
*/
import { createChoices, getChoicesValues, type Choices } from '../choices';
import { FuzzySearch } from '../search';
import { fetchData, debounce, escapeHtml, getGitHubUrl, getInstallDropdownHtml, setupDropdownCloseHandlers } from '../utils';
import { fetchData, debounce, escapeHtml, getGitHubUrl, getInstallDropdownHtml, setupDropdownCloseHandlers, getActionButtonsHtml, setupActionHandlers } from '../utils';
import { setupModal, openFileModal } from '../modal';
interface Agent {
@@ -103,6 +103,7 @@ function renderItems(items: Agent[], query = ''): void {
</div>
<div class="resource-actions">
${getInstallDropdownHtml(resourceType, item.path, true)}
${getActionButtonsHtml(item.path, true)}
<a href="${getGitHubUrl(item.path)}" class="btn btn-secondary btn-small" target="_blank" onclick="event.stopPropagation()">
GitHub
</a>
@@ -170,6 +171,7 @@ export async function initAgentsPage(): Promise<void> {
setupModal();
setupDropdownCloseHandlers();
setupActionHandlers();
}
// Auto-initialize when DOM is ready

View File

@@ -3,7 +3,7 @@
*/
import { createChoices, getChoicesValues, type Choices } from '../choices';
import { FuzzySearch } from '../search';
import { fetchData, debounce, escapeHtml, getGitHubUrl, getInstallDropdownHtml, setupDropdownCloseHandlers } from '../utils';
import { fetchData, debounce, escapeHtml, getGitHubUrl, getInstallDropdownHtml, setupDropdownCloseHandlers, getActionButtonsHtml, setupActionHandlers } from '../utils';
import { setupModal, openFileModal } from '../modal';
interface Instruction {
@@ -73,6 +73,7 @@ function renderItems(items: Instruction[], query = ''): void {
</div>
<div class="resource-actions">
${getInstallDropdownHtml('instructions', item.path, true)}
${getActionButtonsHtml(item.path, true)}
<a href="${getGitHubUrl(item.path)}" class="btn btn-secondary btn-small" target="_blank" onclick="event.stopPropagation()">
GitHub
</a>
@@ -122,6 +123,7 @@ export async function initInstructionsPage(): Promise<void> {
setupModal();
setupDropdownCloseHandlers();
setupActionHandlers();
}
// Auto-initialize when DOM is ready

View File

@@ -3,7 +3,7 @@
*/
import { createChoices, getChoicesValues, type Choices } from '../choices';
import { FuzzySearch } from '../search';
import { fetchData, debounce, escapeHtml, getGitHubUrl, getInstallDropdownHtml, setupDropdownCloseHandlers } from '../utils';
import { fetchData, debounce, escapeHtml, getGitHubUrl, getInstallDropdownHtml, setupDropdownCloseHandlers, getActionButtonsHtml, setupActionHandlers } from '../utils';
import { setupModal, openFileModal } from '../modal';
interface Prompt {
@@ -68,6 +68,7 @@ function renderItems(items: Prompt[], query = ''): void {
</div>
<div class="resource-actions">
${getInstallDropdownHtml(resourceType, item.path, true)}
${getActionButtonsHtml(item.path, true)}
<a href="${getGitHubUrl(item.path)}" class="btn btn-secondary btn-small" target="_blank" onclick="event.stopPropagation()">
GitHub
</a>
@@ -117,6 +118,7 @@ export async function initPromptsPage(): Promise<void> {
setupModal();
setupDropdownCloseHandlers();
setupActionHandlers();
}
// Auto-initialize when DOM is ready