feat(overlay): run session help commands with Enter or double-click (#275)

This commit is contained in:
2026-09-29 18:48:56 -07:00
committed by GitHub
parent 4e43c5c6e1
commit 0bbd8617f4
16 changed files with 701 additions and 49 deletions
+15 -2
View File
@@ -1,6 +1,10 @@
import type { SessionHelpItem, SessionHelpSection } from './session-help-sections';
function createShortcutRow(row: SessionHelpItem, globalIndex: number): HTMLButtonElement {
function createShortcutRow(
row: SessionHelpItem,
globalIndex: number,
commandsEnabled: boolean,
): HTMLButtonElement {
const button = document.createElement('button');
button.type = 'button';
button.className = 'session-help-item';
@@ -28,6 +32,14 @@ function createShortcutRow(row: SessionHelpItem, globalIndex: number): HTMLButto
right.insertBefore(dot, action);
}
if (commandsEnabled && row.command) {
button.classList.add('session-help-item-runnable');
const hint = document.createElement('span');
hint.className = 'session-help-run-hint';
hint.textContent = 'Run ↵';
right.appendChild(hint);
}
button.appendChild(left);
button.appendChild(right);
return button;
@@ -54,6 +66,7 @@ export function createSessionHelpSectionNode(
section: SessionHelpSection,
sectionIndex: number,
globalIndexMap: number[],
commandsEnabled: boolean,
): HTMLElement {
const sectionNode = document.createElement('section');
sectionNode.className = 'session-help-section';
@@ -69,7 +82,7 @@ export function createSessionHelpSectionNode(
section.rows.forEach((row, rowIndex) => {
const globalIndex = (globalIndexMap[sectionIndex] ?? 0) + rowIndex;
const button = createShortcutRow(row, globalIndex);
const button = createShortcutRow(row, globalIndex, commandsEnabled);
list.appendChild(button);
});