mirror of
https://github.com/github/awesome-copilot.git
synced 2026-06-25 17:00:20 +00:00
8cdeb2d2ed
* Prototype extension details modal - Add detail popup modal for extension cards with full metadata and gallery - Implement image gallery with thumbnail strip and main image selection - Add modal styling and positioning in global.css - Connect card click handlers to open modal with extension data Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix accessibility issues with modal focus restoration - Add missing listing-cards-page class to agents.astro page root - Pass focusable button element to openCardDetailsModal instead of article - Fixes focus restoration for keyboard users when closing modal - Applied fix across all listing pages (agents, instructions, hooks, plugins, skills, workflows) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address remaining PR review feedback - Fix extension modal ARIA state by setting aria-current to "true" and removing it when inactive - Use focusable .resource-preview as modal trigger for extension thumbnail/click/keyboard paths - Extract shared multi-select helpers into pages/select-utils.ts and reuse across instructions/hooks/plugins/workflows - Remove unused card-model.ts to avoid dead/overlapping type definitions Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
import {
|
|
escapeHtml,
|
|
getActionButtonsHtml,
|
|
getGitHubUrl,
|
|
getLastUpdatedHtml,
|
|
} from '../utils';
|
|
import { renderEmptyStateHtml, renderSharedCardHtml } from './card-render';
|
|
|
|
export interface RenderableWorkflow {
|
|
title: string;
|
|
description?: string;
|
|
path: string;
|
|
triggers: string[];
|
|
lastUpdated?: string | null;
|
|
}
|
|
|
|
export type WorkflowSortOption = 'title' | 'lastUpdated';
|
|
|
|
export function sortWorkflows<T extends RenderableWorkflow>(
|
|
items: T[],
|
|
sort: WorkflowSortOption
|
|
): T[] {
|
|
return [...items].sort((a, b) => {
|
|
if (sort === 'lastUpdated') {
|
|
const dateA = a.lastUpdated ? new Date(a.lastUpdated).getTime() : 0;
|
|
const dateB = b.lastUpdated ? new Date(b.lastUpdated).getTime() : 0;
|
|
return dateB - dateA;
|
|
}
|
|
|
|
return a.title.localeCompare(b.title);
|
|
});
|
|
}
|
|
|
|
export function renderWorkflowsHtml(
|
|
items: RenderableWorkflow[]
|
|
): string {
|
|
if (items.length === 0) {
|
|
return renderEmptyStateHtml('No workflows found', 'Try adjusting the selected filters.');
|
|
}
|
|
|
|
return items
|
|
.map((item) => {
|
|
const metaHtml = `
|
|
${item.triggers
|
|
.map((trigger) => `<span class="resource-tag tag-trigger">${escapeHtml(trigger)}</span>`)
|
|
.join('')}
|
|
${getLastUpdatedHtml(item.lastUpdated)}
|
|
`;
|
|
|
|
const actionsHtml = `
|
|
${getActionButtonsHtml(item.path)}
|
|
<a href="${getGitHubUrl(item.path)}" class="btn btn-secondary" target="_blank" onclick="event.stopPropagation()" title="View on GitHub">GitHub</a>
|
|
`;
|
|
|
|
return renderSharedCardHtml({
|
|
title: item.title,
|
|
description: item.description || 'No description',
|
|
articleAttributes: {
|
|
'data-path': item.path,
|
|
},
|
|
metaHtml,
|
|
actionsHtml,
|
|
});
|
|
})
|
|
.join('');
|
|
}
|