MCPcopy
hub / github.com/github/awesome-copilot / initAgentsPage

Function initAgentsPage

website/src/scripts/pages/agents.ts:148–183  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

146}
147
148export async function initAgentsPage(): Promise<void> {
149 const list = document.getElementById('resource-list');
150 const sortSelect = document.getElementById('sort-select') as HTMLSelectElement;
151
152 if (!modalReady) {
153 setupModal();
154 modalReady = true;
155 }
156
157 setupResourceListHandlers(list as HTMLElement | null);
158
159 const data = await fetchData<AgentsData>('agents.json');
160 if (!data || !data.items) {
161 if (list) list.innerHTML = '<div class="empty-state"><h3>Failed to load data</h3></div>';
162 return;
163 }
164
165 allItems = data.items;
166 agentByPath = new Map(allItems.map((item) => [item.path, item]));
167
168 const initialSort = getQueryParam('sort');
169 if (initialSort === 'lastUpdated') {
170 currentSort = initialSort;
171 if (sortSelect) sortSelect.value = initialSort;
172 }
173
174 sortSelect?.addEventListener('change', () => {
175 currentSort = sortSelect.value as AgentSortOption;
176 applyFiltersAndRender();
177 syncUrlState();
178 });
179
180 applyFiltersAndRender();
181 setupDropdownCloseHandlers();
182 setupActionHandlers();
183}
184
185// Auto-initialize when DOM is ready
186document.addEventListener('DOMContentLoaded', initAgentsPage);

Callers

nothing calls this directly

Calls 8

setupModalFunction · 0.90
getQueryParamFunction · 0.90
setupActionHandlersFunction · 0.90
addEventListenerMethod · 0.80
applyFiltersAndRenderFunction · 0.70
syncUrlStateFunction · 0.70

Tested by

no test coverage detected