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

Function configureSkillFileSwitcher

website/src/scripts/modal.ts:369–400  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

367}
368
369async function configureSkillFileSwitcher(filePath: string): Promise<void> {
370 const switcher = document.getElementById("modal-file-switcher");
371 const fileButtonLabel = document.getElementById("modal-file-button-label");
372 const menu = document.getElementById("modal-file-menu");
373
374 if (!switcher || !fileButtonLabel || !menu) return;
375
376 const skillItem = await getSkillItemByFilePath(filePath);
377 if (currentFilePath !== filePath) return;
378
379 if (!skillItem || skillItem.files.length <= 1) {
380 switcher.classList.add("hidden");
381 fileButtonLabel.textContent = "";
382 menu.innerHTML = "";
383 return;
384 }
385
386 fileButtonLabel.textContent = getFileName(filePath);
387 menu.innerHTML = skillItem.files
388 .map(
389 (file) =>
390 `<button type="button" class="modal-file-menu-item${
391 file.path === filePath ? " active" : ""
392 }" data-path="${escapeHtml(
393 file.path
394 )}" role="menuitemradio" aria-checked="${
395 file.path === filePath ? "true" : "false"
396 }">${escapeHtml(file.name)}</button>`
397 )
398 .join("");
399 switcher.classList.remove("hidden");
400}
401
402function hideSkillFileSwitcher(): void {
403 const switcher = document.getElementById("modal-file-switcher");

Callers 1

openFileModalFunction · 0.85

Calls 3

escapeHtmlFunction · 0.90
getSkillItemByFilePathFunction · 0.85
getFileNameFunction · 0.85

Tested by

no test coverage detected